I’m trying to use distillery and edeliver to deploy and run run a phoenix app in production. I build on a staging server (with one configuration) and deploy to a production server (with a different configuration). I want to provide these different runtime configurations via ENV variables.
Right now, using the format:
config :my_app, MyApp.Endpoint,
http: [port: {:system, "HTTP_PORT"}],
url: [host: {:system, "HOST"}, port: {:system, "URL_PORT"}]
works for the phoenix configs, but not for the ecto/db configs.
At runtime, Postgrex fails to understand this configuration syntax. I tried using the format:
config :my_app, MyApp.Repo,
adapter: Ecto.Adapters.Postgres,
hostname: "${DB_HOSTNAME}",
username: "${DB_USERNAME}",
for my DB configs but this does not work as the strings remain as seen and are not replaced with my ENV variables at runtime.
I’ve read this blog post: http://blog.plataformatec.com.br/2016/05/how-to-config-environment-variables-with-elixir-and-exrm/
but it seems that the ${} format does not work with edeliver??
I’d prefer to not have to deal with creating separate sys.conf files and linking them. What is the proper way to handle all of this? Thanks.