distillery v2.0.8 Mix.Releases.Config.Providers.Elixir View Source

Provides support for Mix.Config config scripts, e.g. config.exs

This provider expects a path to a config file to load during boot as an argument:

set config_providers: [
  {Mix.Releases.Config.Providers.Elixir, ["${RELEASE_ROOT_DIR}/config.exs"]}

The above configuration goes in a release or environment definition in rel/congfig.exs, and will result in the given path being expanded during boot, and evaluated using Mix.Config.


Because much of Mix assumes it is operating in a Mix project context, there are some things you need to be aware of when using Mix.Config in releases:

  • Mix APIs, other than Mix.Config itself, are not guaranteed to work, and most do not. This provider starts Mix when the provider runs, so you can call Mix.env, but it is an exception to the rule. Other functions are unlikely to work, so you should not rely on them being available.
  • Mix.env always returns :prod, unless MIX_ENV is exported in the environment, in which case that value is used instead.
  • The Mix project context is unavailable, as is your build environment, so Mix configs which invoke git or otherwise depend on that context, are not going to work. You need to use configs which are pared down to only reference the target environment (in general configs should be small anyway).

Link to this section Summary

Link to this section Functions

Link to this function merge_config(runtime_config) View Source