<html><head><meta http-equiv="content-type" content="text/html; charset=utf-8"></head><body dir="auto"><div>Hi,</div><div>Why not use functions defined in a conf module? Combined with hot code swapping that should do, shouldn't it?</div><div><br></div><div>Ah, maybe not with releases...</div><div><br>On 11 nov. 2013, at 14:18, Benoit Chesneau <<a href="mailto:bchesneau@gmail.com">bchesneau@gmail.com</a>> wrote:<br><br></div><blockquote type="cite"><div><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>
</div></blockquote><blockquote type="cite"><div><span>_______________________________________________</span><br><span>erlang-questions mailing list</span><br><span><a href="mailto:erlang-questions@erlang.org">erlang-questions@erlang.org</a></span><br><span><a href="http://erlang.org/mailman/listinfo/erlang-questions">http://erlang.org/mailman/listinfo/erlang-questions</a></span><br></div></blockquote></body></html>