[erlang-questions] Docker enviroment variables in releases ?

Dmitry Kolesnikov dmkolesnikov@REDACTED
Sat Mar 2 10:00:21 CET 2019


I’ve built a simple wrapper over application:env and os:get_env for this type of purpose. 

In sys.config you define
{myapp, [
   {port, {env, "CONFIG_MYAPP_PORT", "8080”}}

In erlang code:
Port = opts:val(port, myapp)
Then this function would check value of CONFIG_MYAPP_PORT variable and return it. The default value is return if env is not defined.

If any one finds this feature useful for other projects, I can think of evolving this feature further on. 

Best Regards,

> On 2 Mar 2019, at 10.49, Thomas Elsgaard <thomas.elsgaard@REDACTED> wrote:
> Hi list!
> Any good solutions for using Docker enviroment variables in an Erlang release running i Docker ?
> Like it would be really cool to override default sys.config settings when starting the container with -e SOME_SYS_CONFIG_SETTING=1234
> Thomas
> _______________________________________________
> erlang-questions mailing list
> erlang-questions@REDACTED
> http://erlang.org/mailman/listinfo/erlang-questions

More information about the erlang-questions mailing list