I was re-reading the Phoenix release documentation today, more specifically the section about runtime configuration:
You may have noticed that, in order to assemble our release, we had to set both
DATABASE_URL. That’s because
config/prod.exs, and friends are executed when the release is assembled (or more generally speaking, whenever you run a
However, in many cases, we don’t want to set the values for
DATABASE_URLwhen assembling the release but only when starting the system in production. In particular, you may not even have those values easily accessible, and you may have to reach out to another system to retrieve those.
So, I know I can pull those variables at runtime using
config/releases.ex, but know I’m curious where is the exact place those vars are retrieved at build-time.
For instance, there’s a lot of
System.get_env("MIX_ENV") scattered in the Mix source code, but what about:
DATABASE_URL and others? I couldn’t find any trace of those being used by Phoenix, Plug or Ecto (maybe I haven’t searched properly or Github search is just trolling me ).
PS.: This is for learning purposes, so If there are any other common environment variables that I should know of, please feel free to share those too .