Tooting my own horn here, but I’ve written a blog post that describes a system of configuration that I personally use, where you have the same configuration in development and production: Simple Configuration Setup for Elixir Projects (v1.11+) – Random Notes – Reading it may provide you with some new thoughts.
But to summarise, you can probably move most of your config to config/runtime.exs
like LostKobrakai said. This file is evaluated both in development and production when your system starts up. In that file you can also use your Env module without any issues, as it has already been compiled at that point (just like I use my own env helpers in my blog post). The rest of the “classic” config/*.exs
files are for compile time configuration, which is not needed for most things you want to configure.
If you need environment variables in compile time configuration for some reason, then what you are doing now (with the double-compilation warning) is probably the best you can do.