Account Options

  1. Sign in
The old Google Groups will be going away soon, but your browser is incompatible with the new version.
Google Groups Home
« Groups Home
recommended ways to pass config to a dep app
There are currently too many topics in this group that display first. To make this topic appear first, remove this option from another topic.
There was an error processing your request. Please try again.
flag
  9 messages - Collapse all  -  Translate all to Translated (View all originals)
The group you are posting to is a Usenet group. Messages posted to this group will make your email address visible to anyone on the Internet.
Your reply message has not been sent.
Your post was successful
 
From:
To:
Cc:
Followup To:
Add Cc | Add Followup-to | Edit Subject
Subject:
Validation:
For verification purposes please type the characters you see in the picture below or the numbers you hear by clicking the accessibility icon. Listen and type the numbers you hear
 
AD  
View profile  
 More options Nov 16 2012, 9:28 am
From: AD <straightfl...@gmail.com>
Date: Fri, 16 Nov 2012 09:28:39 -0500
Local: Fri, Nov 16 2012 9:28 am
Subject: [erlang-questions] recommended ways to pass config to a dep app

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?

Cheers
-AD

_______________________________________________
erlang-questions mailing list
erlang-questi...@erlang.org
http://erlang.org/mailman/listinfo/erlang-questions


 
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
Max Lapshin  
View profile  
 More options Nov 16 2012, 9:36 am
From: Max Lapshin <max.laps...@gmail.com>
Date: Fri, 16 Nov 2012 17:35:55 +0300
Local: Fri, Nov 16 2012 9:35 am
Subject: Re: [erlang-questions] recommended ways to pass config to a dep app

application:load(stockdb),
application:set_env(stockdb, key, value),
application:start(stockdb),

_______________________________________________
erlang-questions mailing list
erlang-questi...@erlang.org
http://erlang.org/mailman/listinfo/erlang-questions


 
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
Garrett Smith  
View profile  
 More options Nov 16 2012, 9:36 am
From: Garrett Smith <g...@rre.tt>
Date: Fri, 16 Nov 2012 08:35:42 -0600
Local: Fri, Nov 16 2012 9:35 am
Subject: Re: [erlang-questions] recommended ways to pass config to a dep app

On Fri, Nov 16, 2012 at 8:28 AM, AD <straightfl...@gmail.com> 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?

The canonical approach is explained here:

http://www.erlang.org/doc/design_principles/applications.html#id74117

The inets application is a good example of how one can hide a lot of
complexity behind the application abstraction, and use Erlang's
standard app config mechanism to customize behavior.

Garrett
_______________________________________________
erlang-questions mailing list
erlang-questi...@erlang.org
http://erlang.org/mailman/listinfo/erlang-questions


 
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
Garrett Smith  
View profile  
 More options Nov 16 2012, 10:10 am
From: Garrett Smith <g...@rre.tt>
Date: Fri, 16 Nov 2012 09:09:58 -0600
Local: Fri, Nov 16 2012 10:09 am
Subject: Re: [erlang-questions] recommended ways to pass config to a dep app

On Fri, Nov 16, 2012 at 8:35 AM, Max Lapshin <max.laps...@gmail.com> 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 <straightfl...@gmail.com> 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
_______________________________________________
erlang-questions mailing list
erlang-questi...@erlang.org
http://erlang.org/mailman/listinfo/erlang-questions

 
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
Max Lapshin  
View profile  
 More options Nov 16 2012, 10:19 am
From: Max Lapshin <max.laps...@gmail.com>
Date: Fri, 16 Nov 2012 18:19:17 +0300
Local: Fri, Nov 16 2012 10:19 am
Subject: Re: [erlang-questions] recommended ways to pass config to a dep app

> 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.

I've tried to use releases in erlyvideo for a year and totally refused from
then and I don't see even a single reason for me to return back to them.
So, there is nothing bad in application:start/1, it is a good way to deploy
and launch system.

There is a nice startup function now in erlyvideo, that does all setup
(which differs for runtime and for tests), it loads
all data from config file.

application config file is a bad place for configuring your application,
because it generates nowadays from app.src and exists somewhere in
/usr/lib/...

configuration file lives in /etc/

_______________________________________________
erlang-questions mailing list
erlang-questi...@erlang.org
http://erlang.org/mailman/listinfo/erlang-questions


 
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
Dmitry Kolesnikov  
View profile  
 More options Nov 16 2012, 10:28 am
From: Dmitry Kolesnikov <dmkolesni...@gmail.com>
Date: Fri, 16 Nov 2012 17:28:36 +0200
Local: Fri, Nov 16 2012 10:28 am
Subject: Re: [erlang-questions] recommended ways to pass config to a dep app

Hello Max,

I would _really_ propose you to came back to releases. Rebar + reltool makes distribution of you application in a form of self contained tarball.

Of corse there is nothing bad with application:start but I hardly see how your handle node and application restart. Proper release config + heart bring couple of advantages on fault handling.

BTW, there is no need to to touch app.src file for application configuration. All applications are configured through sys.config. You can also make your config file to be placed into /etc or even make hierarchy of configs.

- Dmitry

On Nov 16, 2012, at 5:19 PM, Max Lapshin wrote:

_______________________________________________
erlang-questions mailing list
erlang-questi...@erlang.org
http://erlang.org/mailman/listinfo/erlang-questions


 
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
Garrett Smith  
View profile  
 More options Nov 16 2012, 10:31 am
From: Garrett Smith <g...@rre.tt>
Date: Fri, 16 Nov 2012 09:30:47 -0600
Local: Fri, Nov 16 2012 10:30 am
Subject: Re: [erlang-questions] recommended ways to pass config to a dep app

On Fri, Nov 16, 2012 at 9:19 AM, Max Lapshin <max.laps...@gmail.com> wrote:

>> 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.

> I've tried to use releases in erlyvideo for a year and totally refused from
> then and I don't see even a single reason for me to return back to them. So,
> there is nothing bad in application:start/1, it is a good way to deploy and
> launch system.

Understood. But there is a payoff in getting this to work. Understood though :)

I want to set aside some time to check out Eric Merrit's relcool (I
came up with the name :)

https://github.com/erlware/relcool

> There is a nice startup function now in erlyvideo, that does all setup
> (which differs for runtime and for tests), it loads
> all data from config file.

Reinventing the wheel, but that's cool - it's not a complicated wheel.

> application config file is a bad place for configuring your application,
> because it generates nowadays from app.src and exists somewhere in
> /usr/lib/...

> configuration file lives in /etc/

You're confused. App config has nothing to do with app.src and
certainly lives in /etc/

It's the file you pass here:

erl -config CONFIG

Garrett
_______________________________________________
erlang-questions mailing list
erlang-questi...@erlang.org
http://erlang.org/mailman/listinfo/erlang-questions


 
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
Max Lapshin  
View profile  
 More options Nov 16 2012, 10:40 am
From: Max Lapshin <max.laps...@gmail.com>
Date: Fri, 16 Nov 2012 18:40:10 +0300
Local: Fri, Nov 16 2012 10:40 am
Subject: Re: [erlang-questions] recommended ways to pass config to a dep app

Thank you, guys, a lot, but I'm not going to return to releases =)

erlyvideo is just a plain unix software, like apache or sendmail, that is
installed by people, that are hearing about erlang for the first time.

They can modify only one file in /etc/, so I need to read it before
startup. But there may not be this file, so I need to look for in in other
place.

I really don't see any use in releases for me, so my way of configuring
applications inside erlang node is very, very convenient and it is
_working_. Working in  _my practice_.

_______________________________________________
erlang-questions mailing list
erlang-questi...@erlang.org
http://erlang.org/mailman/listinfo/erlang-questions


 
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
Garrett Smith  
View profile  
 More options Nov 16 2012, 10:49 am
From: Garrett Smith <g...@rre.tt>
Date: Fri, 16 Nov 2012 09:49:18 -0600
Local: Fri, Nov 16 2012 10:49 am
Subject: Re: [erlang-questions] recommended ways to pass config to a dep app
I'd stick with what is working as well!

But just a point of clarification -- releases are hard for release
engineers, not for end users. I deploy all Erlang projects as releases
for that reason. You get a nice distribution that can be configured
trivially with a single config file and further refined with command
line options.

There is a theoretical downside to asking users to edit Erlang term
files. I treat this as a UI problem to config and so have used
converters from, say YML, to Erlang config files that are run at
startup so users don't get into that layer. But since the Erlang init
process is so central to Erlang itself, I prefer to leverage it rather
than roll something different.

But understood :)

_______________________________________________
erlang-questions mailing list
erlang-questi...@erlang.org
http://erlang.org/mailman/listinfo/erlang-questions

 
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
End of messages
« Back to Discussions « Newer topic     Older topic »