Hey!
I have a quick question that doesn’t seem to be explicitly mentioned anywhere in the docs. Does runtime.exs have access to the environment variables declared as part of your env.sh when deploying a mix release? It feels like it should but again can’t find anything that explicitly states it does and nothing to the contrary either…
Thanks!
1 Like
I found this in the documentation:
rel/env.sh.eex
and rel/env.bat.eex
- template files that are copied into every release and are executed on every command to set up environment variables, including specific ones to the VM, and the general environment
So I believe so.
A Phoenix release with runtime.exs
will also have access to all environment variables like:
PORT=4000 build/prod/rel/new_phoenix/bin/new_phoenix start
I talked about it in my latest post:
If you want to export all variables from an environment file that doesn’t come with the release, you can do the following in Bash:
set -o allexport
source env.sh
set +o allexport
build/prod/rel/new_phoenix/bin/new_phoenix start
5 Likes