[erlang-questions] How do I move this into a config file?

Matthew Hillsborough matthew.hillsborough@REDACTED
Fri Aug 26 05:02:18 CEST 2011


Hi everyone,

I have some hard coded defines in one of my modules that looks like the
following:

-ifdef(debug).

-define(FOOBAR, "DEBUG_FOOBAR").

-else.

-define(FOOBAR, "PROD_FOOBAR").

-endif.

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:

   - How does one move the above into an external configuration file and
   then read it back into the application?


   - I need to have multiple configurations as I will have different vms
   hitting different FOOBAR 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.

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.

Thanks all!

Matthew
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://erlang.org/pipermail/erlang-questions/attachments/20110825/b99b8d1b/attachment.htm>


More information about the erlang-questions mailing list