Ulf Wiger ulf.wiger@REDACTED
Tue Feb 9 08:17:57 CET 1999

Ulf Wiger wrote:
> Setting the environment variables programmatically *can* be done, but
> you have to use an internal function in the application_controller:
>         application_controller:set_env(AppName, Key, Value)
> It is not recommended, and you will not find the function in any manual.

Ok, confession time. ;)
I *have* done this myself in production code:

	patch_load_mnesia(Dir) ->
	    application_controller:set_env(mnesia, dir, Dir).

After this, you may issue application:start(mnesia).

I do this in an installation program, which also configures a start
command and a sys.config file. After that, all parameters are set
correctly every time the system is started.

However, there is also a function, mnesia:start(ExtraEnv), which does
the same thing. It is not official either, so I guess it's just a matter
of choosing your favourite undocumented feature and running with it. ;)

I still recommend messing with the env variables at installation only,
and not afterwards.

Ulf Wiger, Chief Designer AXD 301     <ulf.wiger@REDACTED>
Ericsson Telecom AB                          tfn: +46  8 719 81 95
Varuvägen 9, Älvsjö                          mob: +46 70 519 81 95
S-126 25 Stockholm, Sweden                   fax: +46  8 719 43 44

More information about the erlang-questions mailing list