leishman
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: How to config environment variables with Elixir and Exrm « Plataformatec Blog
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.
Trending in Questions
Other Trending Topics
Categories:
Sub Categories:
Forums
Popular Tags
- #ecto
- #liveview
- #troubleshooting
- #learning-elixir
- #library
- #deployment
- #erlang
- #testing
- #genserver
- #mix
- #absinthe
- #remote-other
- #otp
- #plug
- #how-to-question
- #macros
- #postgres
- #elixirconf
- #channels
- #exunit
- #discussion
- #code-sync
- #podcasts
- #javascript
- #onsite
- #dialyzer
- #docker
- #authentication
- #umbrella
- #full-time-contract
- #podcasts-by-brainlid
- #ecto-query
- #elixirconf-us
- #blog-post
- #ai
- #elixir-ls
- #phoenix_html
- #iex
- #graphql
- #genstage
- #websockets
- #supervisor
- #advent-of-code
- #distillery
- #processes
- #api
- #forms
- #hex
- #security
- #metaprogramming











Showing Posts 1 to 4- Show Best Posts
- Show All (oldest first)
- Show All (newest first)
jwarlander
The difference is between ExRM and Distillery..
Instead of
RELX_REPLACE_OS_VARS=true, tryREPLACE_OS_VARS=true.It’s mentioned for vm.args in the Distillery docs, but definitely applies to sys.config as well.
AndrewDryga
For people that found this article by googling it - I’ve written an article on configuration and deployments topic, checking it out.
Also, try reading Distillery docs, they are pretty comprehensive.
idi527
I’ve seen you mention vault in an ecto thread once (and in the article), have you had any success with using it for configuration?
Thank you for the article btw.
AndrewDryga
I’ve rewritten Confex to support configuration adapters and started writing a Vault adapter for it. But then we postponed this task to the later development stages to concentrate on more important things for the project.