Is it ok to read an env variable like this in
I’m using it to conditionally load Oban Web & Pro packages.
It works in development.
Yet, in production, it’s like the env variable doesn’t exist — and it does.
Any idea? Thanks!
If you’re using releases, then
mix.exs won’t be executed. You must set the environment variable before compiling a production release.
Yes, I am using releases on fly.io
How should I set the env variable?
Do you mean something like this in
RUN NOTESCLUB_IS_OBAN_WEB_PRO_ENABLED=true \
mix deps.get --only $MIX_ENV
If it helps, you can see the full Dockerfile here.
It still doesn’t find the env variable.
What am I missing?
NOTESCLUB_IS_OBAN_WEB_PRO_ENABLED in a few
RUN statements, but you could set it with
Thanks, it’s working now.
Besides using ENV, I also set the env variable to
"true" instead of
As a reference, I updated the Dockerfile
Sorry for reviving this thread after a few months, but I wonder if conditionally adding dependencies with an environment variable is really the right approach with the Oban Pro dependencies. Is this the recommended approach? If not, what would be an alternative? I’m asking since the notesclub project isn’t tracking
mix.lock due to those optional dependencies.
What do you think @sorentwo? Thank you for your input
I just want to say thank you for sharing your dockerfile. Deployment is the hardest thing for me to find resources on.
By the way, @stevensonmt, if you saw the gist, the latest dockerfile in the repo might help as it is more up to date.