<div dir="ltr">Hi all,<div><br></div><div>Until now I was using either an ini file (using <a href="http://github.com/benoitc/econfig">http://github.com/benoitc/econfig</a>) to handle the config on my app. Econfig allows me to reload the config and update it in live relatively easily .</div>
<div><br></div><div>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 (<a href="https://github.com/basho/cuttlefish">https://github.com/basho/cuttlefish</a>) . 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?</div>
<div><br></div><div><br></div><div>I found an old mail that was suggestiing to use `<span style="color:rgb(0,0,0);font-family:Verdana,Geneva,Helvetica,Arial,sans-serif;font-size:13px">application_controller:change_application_data` like this</span></div>
<div><br></div><div><br></div><div><span style="color:rgb(0,0,0);font-family:Verdana,Geneva,Helvetica,Arial,sans-serif;font-size:13px">reload_config(AppNames, ConfigFile) -> </span><br style="color:rgb(0,0,0);font-family:Verdana,Geneva,Helvetica,Arial,sans-serif;font-size:13px">
<span style="color:rgb(0,0,0);font-family:Verdana,Geneva,Helvetica,Arial,sans-serif;font-size:13px"> {ok, [Config]} = file:consult(ConfigFile), </span><br style="color:rgb(0,0,0);font-family:Verdana,Geneva,Helvetica,Arial,sans-serif;font-size:13px">
<span style="color:rgb(0,0,0);font-family:Verdana,Geneva,Helvetica,Arial,sans-serif;font-size:13px"> Apps = [{application, A, element(2,application:get_all_key(A))} </span><br style="color:rgb(0,0,0);font-family:Verdana,Geneva,Helvetica,Arial,sans-serif;font-size:13px">
<span style="color:rgb(0,0,0);font-family:Verdana,Geneva,Helvetica,Arial,sans-serif;font-size:13px"> || {A,_,_} <- application:while_applications()], </span><br style="color:rgb(0,0,0);font-family:Verdana,Geneva,Helvetica,Arial,sans-serif;font-size:13px">
<span style="color:rgb(0,0,0);font-family:Verdana,Geneva,Helvetica,Arial,sans-serif;font-size:13px"> application_controller:change_application_data(Apps,Config). </span><br></div><div><span style="color:rgb(0,0,0);font-family:Verdana,Geneva,Helvetica,Arial,sans-serif;font-size:13px"><br>
</span></div><div><span style="color:rgb(0,0,0);font-family:Verdana,Geneva,Helvetica,Arial,sans-serif;font-size:13px"><br></span></div><div><font color="#000000" face="Verdana, Geneva, Helvetica, Arial, sans-serif"><a href="http://erlang.2086793.n4.nabble.com/Loading-application-variables-td2089610.html">http://erlang.2086793.n4.nabble.com/Loading-application-variables-td2089610.html</a></font><br>
</div><div><font color="#000000" face="Verdana, Geneva, Helvetica, Arial, sans-serif"><br></font></div><div><font color="#000000" face="Verdana, Geneva, Helvetica, Arial, sans-serif">though `</font><span style="color:rgb(0,0,0);font-family:Verdana,Geneva,Helvetica,Arial,sans-serif;font-size:13px">application_controller:change_application_data` is not public. Should I update the config using `application:set_env` instead? Any other way?</span></div>
<div><span style="color:rgb(0,0,0);font-family:Verdana,Geneva,Helvetica,Arial,sans-serif;font-size:13px"><br></span></div><div><span style="color:rgb(0,0,0);font-family:Verdana,Geneva,Helvetica,Arial,sans-serif;font-size:13px">- benoit</span></div>
</div>