I’m deploying my Phoenix app with edeliver and distillery and reading config values from environment variables. I can read normal strings just fine, but how do I handle 1.) a list of strings and 2.) numbers?
For 1, the list of strings:
In my config/prod.exs i have allowed_users: ["${ALLOWED_USERS}"],
Here is my sys.config file with the problematic variable:
allowed_users,[<<"${ALLOWED_USERS}">>]},
My environment variable being exported is (i’ve escaped the strings, but it’s not really helping):
export ALLOWED_USERS="\"john\", \"alice\""
When I don’t use an environment variable in my config file and just enter the values directly, then the compiled sys.config looks as follows, so that’s what I need:
allowed_users,[<<"john">>,<<"alice">>],
I can export the following export ALLOWED_USERS="john\">>,<<"alice"
as the environment variable and that works, but it feels clunky.
Also, question 2. How can I get a number for a config value that is exported as an environment variable?
My config/prod.exs has this variable enable_salt_workers: "${ENABLE_SALT_WORKERS}"
, which
i export as export ENABLE_SALT_WORKERS=true
, but it ends up as a string in sys.config as follows {enable_salt_workers,<<"true">>},
instead of {enable_salt_workers,true},
Any help would be appreciated.