[erlang-questions] specifying OS-level environment variables

Ivan Uemlianin ivan@REDACTED
Wed Nov 30 11:35:47 CET 2016

Dear All

I am writing an erlang application, and one of its dependencies requires 
an OS environment variable to be set.  For sake of argument:

     XYZ_HOME = /path/to/lib/

What is the best way to express this requirement to the user?  I can 
think of two ways.  Are there other, better, ways?

1. Just put it in the documentation, along with other system 
requirements: "Needs XYZ_HOME to be set otherwise won't work."

2. Put a "sensible default" in the .app.src and/or sys.config, document 
these application configs, and during application startup use os:putenv, 

     {ok, XYZ_HOME} = application:get_env(myapp, xyz_home),
     os:putenv("XYZ_HOME", XYZ_HOME),

The first doesn't seem very friendly and I shouldn't think will be very 
effective.  Is the second a correct use case for os:putenv?

Is there a third way that is even better?

With thanks and best wishes


Ivan A. Uemlianin PhD
Speech Technology Research and Development


                         festina lente

More information about the erlang-questions mailing list