How does configuration in prod.exs and releases.exs works?

Hi everyone!

I’ve been trying to understand how configuration works, so my question is why is there a need for a specific releases configuration? I know Mix is not available in the release but I don’t understand what’s the relationship between prod.exs and releases.exs, or why we need both and not just one of them.

1 Like

Every configuration file besides releases.exs is evaluated at build time when you create a release. Mix does detect changes in the config and tell you to reload, but for releases this is not an option. So if you need configuration, which is evaluated on startup and not at the time/machine where your release is built you‘ll need to do that in releases.exs. For any configuration which is static in a compiled production release you‘d use prod.exs.


Thanks @LostKobrakai :smiley: that makes things clearer, the only thing I’m wondering is why sometimes we configure the same thing, for example, an Endpoint in both files?

1 Like