[erlang-questions] reload application configuration

Benoit Chesneau bchesneau@REDACTED
Mon Nov 11 15:18:51 CET 2013


Hi all,

Until now I was using either an ini file (using
http://github.com/benoitc/econfig)  to handle the config on my app. Econfig
allows me to reload the config and update it in live relatively easily .

But INI is a rather limited format and I don't really want to use something
YAML or TOML. Instead I was thinking to use pur application config and
maybe cuttlefish (https://github.com/basho/cuttlefish) . But I wonder how
to change the config in live. Say for example having a an HTTP config
handler that allows the user to change some  settings, triggering the
config changes in the applications and writing them on the disk. Is there a
way to do that?


I found an old mail that was suggestiing to use
`application_controller:change_application_data`
like this


reload_config(AppNames, ConfigFile) ->
     {ok, [Config]} = file:consult(ConfigFile),
     Apps = [{application, A, element(2,application:get_all_key(A))}
             || {A,_,_} <- application:while_applications()],
     application_controller:change_application_data(Apps,Config).


http://erlang.2086793.n4.nabble.com/Loading-application-variables-td2089610.html

though `application_controller:change_application_data` is not public.
Should I update the config using `application:set_env` instead? Any other
way?

- benoit
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://erlang.org/pipermail/erlang-questions/attachments/20131111/1e8a73b6/attachment.htm>


More information about the erlang-questions mailing list