proper use of application:set_env?

Pablo Platt pablo.platt@REDACTED
Thu Nov 12 23:31:07 CET 2009


I have an application that start a mochiweb server.
The same application handles several vhosts.
Each vhost has a config file with dispatch-list + handlers, db-name, secret-string...
The handlers are modules which need to know about the settings in the config file, for example the db name or the sercret-string to authenticate users.
I don't want to access the config file every time because of performance.

Is it ok to use 
application:set_env('example.com_setting1', "some setting1") ,
application:set_env('example.com_setting2', "some setting2"),
application:set_env('other-domain.com_setting1', "some setting1") ...
and then access it from the handlers?
Is there a performance price for using application_get_env for every request?



More information about the erlang-questions mailing list