[erlang-questions] recommended ways to pass config to a dep app

Garrett Smith g@REDACTED
Fri Nov 16 16:09:58 CET 2012


On Fri, Nov 16, 2012 at 8:35 AM, Max Lapshin <max.lapshin@REDACTED> wrote:
> application:load(stockdb),
> application:set_env(stockdb, key, value),
> application:start(stockdb),

Though this pattern just shifts the question -- where does Value come from?

If you use the standard pattern in Erlang of application config files,
Value is defined in that file and the application can use
application:get_env without the additional burden of app config
management.

IMO application:start/1 is also a bad smell outside dev/test modes.
When you deploy as an Erlang release, applications are started by the
init system process.

That said, doing releases in Erlang is *still very painful*, so it's
understandable that there's a lot of roll your own system
config/startup patterns in the field. I tend to push through to get
releases working because at runtime the scheme works very well.

> On Fri, Nov 16, 2012 at 6:28 PM, AD <straightflush@REDACTED> wrote:
>>
>> Hello,
>>
>>  I am abstracting some code into a "library" that can be included in other
>> applications.  This library requires a fair bit of config options, what is
>> the recommended approach here when starting it up?
>>
>>  I noticed some libraries like cowboy, you pass all the configs into the
>> main  start_http() method, others use include files.
>>
>>  Is there a preferred mechanism here when there are 20-25 config options
>> for the included application?

Garrett



More information about the erlang-questions mailing list