[erlang-questions] Use of application environment
Tue Nov 25 04:27:35 CET 2008
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
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?
-------------- next part --------------
An HTML attachment was scrubbed...
More information about the erlang-questions