Simply:
-
releases.exs
- runtime configuration forrelease
only -
#{Mix.env()}.exs
- i.e.dev.exs
,prod.exs
,test.exs
- those are compiletime environment-specific configuration files -
config.exs
- compiletime generic configuration file -
releases.exs
- runtime generic configuration file
Please look that machine which compiles code does not needs to run it. When calling System.get_env/1
it’s not executed in some kind of configuration queue, but immediately! This means that machine building code (regardless if it would run it or not) must have specified all environment variables.
Obviously it causes many troubles especially when same project was deployed to multiple machines when each of such machine wanted different environment configuration. It has been partially solved by releases.exs
which now should be replaced by more generic runtime.exs
.
I recommend to watch this video: