[erlang-questions] Environment variables in sasl.config

Scott Lystig Fritchie fritchie@REDACTED
Wed May 23 20:26:41 CEST 2007


>>>>> "ds" == Dave Smith <dizzyd@REDACTED> writes:

ds> Unfortunately, it
ds> seems that only erlang terms can be used in sasl.config, not
ds> functions (such as os:getenv/1). Is there something I'm missing
ds> here?

I've faced the same problem and came up with a naive solution: use
awk/sed/Tcl/Perl to mangle a .config.template file after a startup
shell script starts but before starting the Erlang VM ... creating the
.config file.  It's ugly but at least it's straightforward and has a
long-if-not-quite-noble history in the UNIX world.

I'm not aware of any OTP'ish thing to avoid it ... but my knowledge of
OTP's nooks and crannies isn't as thorough as it ought to be.

-Scott

%% This template is edited to become the FILE for "erl -config FILE".
%% The "__FOO__" patterns are replaced via regexps.

[
 {kernel,
  [{distributed, [{my_active_standby_server, 3000, [{__NODELIST__}]}]},
   {sync_nodes_mandatory, []},
   {sync_nodes_optional, [__NODELIST_MINUS_ME__]},
   {sync_nodes_timeout, 2000}
  ]
 }
]



More information about the erlang-questions mailing list