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

Rapsey rapsey@REDACTED
Fri Aug 26 09:17:55 CEST 2011


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.
It works great with how we use erlang. Which typically involves updating
servers daily, often more than that with small increments.


Sergej

On Fri, Aug 26, 2011 at 5:02 AM, Matthew Hillsborough <
matthew.hillsborough@REDACTED> wrote:

> 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
>
> _______________________________________________
> erlang-questions mailing list
> erlang-questions@REDACTED
> http://erlang.org/mailman/listinfo/erlang-questions
>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://erlang.org/pipermail/erlang-questions/attachments/20110826/5fc424fe/attachment.htm>


More information about the erlang-questions mailing list