[erlang-questions] Environment variables for release
Wed Jan 9 15:12:57 CET 2013
Yea i think that was it thanks. One follow-up here, the 'startup' of the
library depends on the parent app thats including it since it can override
some startup parameters via environment variables. Is there a best
practice here? I figure you can either
1 - manually start it with application:start(library) in the parent apps
start() and remove it from the auto-start list in release
2 - have a separate supervisor that starts the library but doesnt start the
workers (kind of like how cowboy only starts the clock, but you have to do
cowboy:start_http() in your app).
The problem is I only really have 1 gen_server to start and i would like
the calling application to load first so it can override with its own
Any best practice advise appreciated.
On Mon, Jan 7, 2013 at 10:36 AM, Ulf Wiger <> wrote:
> One suggestion:
> The application lib must be loaded before get_env() can work.
> Ulf W
> On 7 Jan 2013, at 15:15, AD wrote:
> I have a library being built that is leveraging environment variables.
> There is a line in the library include file that looks like
> -define(CONST, lib:get_env(Key,Default)).
> the lib:get_env function simply checks
> application:get_env(lib, Key) % in order to check the library.app first
> and then
> application:get_env(Key) % check for local overrides
> However when i place variables like the following in the main example.app
> file in ebin/
> Nothing is getting read. I am not sure if this needs to be in
> rel/files/app.config instead?
> Appreciate any help here.
> erlang-questions mailing list
> Ulf Wiger, Co-founder & Developer Advocate, Feuerlabs Inc.
-------------- next part --------------
An HTML attachment was scrubbed...
More information about the erlang-questions