[erlang-questions] Use of application environment
Tue Dec 2 21:54:48 CET 2008
I have been doing the same for years, I find it works better. Though I try
to keep calls to config fairly isolated choosing to pass config through as
function args whenever possible. I wrapped config with another application
called GAS ( http://erlware.org/lib/5.6.3/gas-6.1.1/) that I find works
nicely in that I can set config at run time and have it reflected ultimately
in my config file if I so choose. I have also added the ability to use
config file overriding, though only one level deep.
On 11/24/08 9:27 PM, "Edwin Fine" <> wrote:
> Hi all,
> Is it considered bad practice to use application environment variables (i.e.
> application:get_env/2,3) in workers, as opposed to only passing config
> information via the start()/init() calls? I am finding it tedious as I add
> more configuration data to the sys.config file, to get_env() the data in a
> supervisor and then parcel it out to the workers. Also, it becomes a pain to
> change the values at runtime, whereas if I put a function like this in an
> affected worker
> my_foo_val() ->
> application:get_env(my_app, my_foo_val, ?SOME_SANE_DEFAULT).
> then runtime changes can be made immediately using set_env(), and it becomes
> much easier to add new config data, but I feel uneasy, almost as if I'm using
> global variables. From a load point of view, I only do this in places where
> the value is not used at a high rate.
> What is the preferred or recommended (or even most common) practice?
> Edwin Fine
> erlang-questions mailing list
If you are not the intended recipient of this e-mail message, please notify the sender
and delete all copies immediately. The sender believes this message and any attachments
were sent free of any virus, worm, Trojan horse, and other forms of malicious code.
This message and its attachments could have been infected during transmission. The
recipient opens any attachments at the recipient's own risk, and in so doing, the
recipient accepts full responsibility for such actions and agrees to take protective
and remedial action relating to any malicious code. Travelport is not liable for any
loss or damage arising from this message or its attachments.
-------------- next part --------------
An HTML attachment was scrubbed...
More information about the erlang-questions