I talk about how I really like to use runtime configuration and discuss some common pitfalls of configuration in Elixir.
This post is so helpful! Thanks a lot!
Especially I like the last part about using Code.require_file/2
. But I tried that and found it doesn’t work in my release app. It is due to the second parameter of Code.require_file/2 which is the relative file path. In my Dockerfile I copy only release output(under _build/prod/rel/) to my workdir, though there is no config/ directory. So I change the file path like that:
case config_env() do
:prod -> Code.require_file("runtime.prod.exs", __ENV__.file |> Path.dirname())
end
Then it works well. Anyway, thanks for the great post again!
2 Likes
Lots of great info I had no idea about! Thanks for sharing!
2 Likes