What we do is have a module that has all configurations for all setups. Then we have modules that just return the name of the current setup. The module that returns a specific name is placed on each server in that setup, the configuration file is the same on all servers across all setups. <br>
It works great with how we use erlang. Which typically involves updating servers daily, often more than that with small increments.<br><br><br>Sergej<br><br><div class="gmail_quote">On Fri, Aug 26, 2011 at 5:02 AM, Matthew Hillsborough <span dir="ltr"><<a href="mailto:matthew.hillsborough@gmail.com">matthew.hillsborough@gmail.com</a>></span> wrote:<br>
<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex;">
<p>Hi everyone,</p><p>I have some hard coded defines in one of my modules that looks like the following:</p>
<p>-ifdef(debug).</p><p>-define(FOOBAR, "DEBUG_FOOBAR").</p>
<p>-else.</p>
<p>-define(FOOBAR, "PROD_FOOBAR").</p>
<p>-endif.</p>
<p>I want to be able to deploy this to multiple servers with a config file using rebar. So I suppose this is a two part question:</p>
<ul>
<li>How does one move the above into an external configuration file and then read it back into the application? </li></ul><ul>
<li>I need to have multiple configurations as I will have different vms hitting different <span>FOOBAR</span> instances. I'm looking to copy these to the appropriate directory with either a bash script or rebar if possible. What's the best way of doing that? ServerA will have external_a.config, ServerB would have external_b.config. Ideally rebar or some third party script would copy that over to external_[x].config and the module that reads this only knows about external.config. I can ultimately get rid of the debug flag and just use an external_local.config file where debug is always enabled. </li>
</ul>
<p>I read about potentially being able to do this with vars.config, but I can't find any examples / documentation supporting it. I want to put this all into my build process and make sure each server has the right FOOBAR defined. I would love any suggestions anyone has, I'm sure you've all dealt with something similar when dealing with multiple environments.</p>
<p>Thanks all!</p><p>Matthew </p>
<br>_______________________________________________<br>
erlang-questions mailing list<br>
<a href="mailto:erlang-questions@erlang.org">erlang-questions@erlang.org</a><br>
<a href="http://erlang.org/mailman/listinfo/erlang-questions" target="_blank">http://erlang.org/mailman/listinfo/erlang-questions</a><br>
<br></blockquote></div><br>