Library or best practise for complex runtime configuration when using `mix release`?

I’m working towards deploying my first Phoenix app to production, and I’m trying to find a good way to add more complex run-time configuration to my app (it’s built with mix release, so there’s no config.exs that can be edited on the deployment server).

Environment variables work great for scalar values, but I need an environment-specific structure like this passed into my app

config :app, :dns
  servers: [
      hostname: "",
      region: "east",
      type: :bind
      hostname: "",
      region: "west",
      type: :nsd4

One approach would be to compile it to JSON and then stuff this JSON into an environment variable, and then read the env-var and parse the JSON in releases.exs, but that is not exactly elegant. Any suggestions for a better way to accomplish this?

1 Like

It sounds like what you are looking for are Config providers

If JSON is your format of choice the sample JSONConfigProvider here will be a good starting point for you. Hope that helps!