<p class="p1">Hi everyone,</p><p class="p1">I have some hard coded defines in one of my modules that looks like the following:</p>
<p class="p2">-ifdef(debug).</p><p class="p2">-define(FOOBAR, "DEBUG_FOOBAR").</p>
<p class="p2">-else.</p>
<p class="p2">-define(FOOBAR, "PROD_FOOBAR").</p>
<p class="p2">-endif.</p>
<p class="p1">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 class="ul1">
<li class="li1">How does one move the above into an external configuration file and then read it back into the application? </li></ul><ul class="ul1">
<li class="li1">I need to have multiple configurations as I will have different vms hitting different <span class="s1">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 class="p1">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 class="p1">Thanks all!</p><p class="p1">Matthew </p>