[erlang-questions] Use of application environment
wde@REDACTED
wde@REDACTED
Tue Nov 25 10:40:11 CET 2008
Hello,
I asked myself the same question.
I read the source code of the application_controller module, the get_env function use access to the local ETS table "ac_tab".
>From a performance point of view, I don't think that it's a problem.
wde
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?
Regards,
Edwin Fine
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://erlang.org/pipermail/erlang-questions/attachments/20081125/fb1cb4c1/attachment.htm>
More information about the erlang-questions
mailing list