Page 1 of 1

Where to store application config?

Posted: Wed Mar 11, 2009 2:41 pm
by pickle
Hi everyone,

I've got a web application server that runs 30 or so separate web applications. All their database credentials and access levels are stored in a central config file. Each separate application loads that file & picks out it's particular database information and access levels.

My question is - do you think it makes more sense to have a central file, or to have each application have it's own config file that stores the database credentials and access levels? I'm noticing as I build more apps, that the design of the new apps is held back a bit by the central file & I'm required to access it in a particular way (particularly - importing a global variable). If each app were silo'd a bit more, I'd have more flexibility to pass that information around as I saw fit.

What do you folks think.

Re: Where to store application config?

Posted: Wed Mar 11, 2009 2:47 pm
by allspiritseve
I think app-specific config sounds a lot more manageable. That also means you don't have to worry as much about namespacing config items.

Re: Where to store application config?

Posted: Wed Mar 11, 2009 2:54 pm
by Benjamin
allspiritseve wrote:I think app-specific config sounds a lot more manageable. That also means you don't have to worry as much about namespacing config items.
I agree, each application is it's own entity and should therefore have it's own configuration file, it's own database etc. There may be a situation where all applications need global configuration options set. Those options, and only those options should go into a central config that each application will include.

Re: Where to store application config?

Posted: Wed Mar 11, 2009 3:05 pm
by Christopher
I use separate files too. But sometimes I have them include a central file if there really is common settings. I think the applications should have a standard source for the configuration data, but have it abstracted or standardized enough that the application does not care what is behind the source of the data. A Config object works well for this.

Re: Where to store application config?

Posted: Wed Mar 11, 2009 4:24 pm
by VirtuosiMedia
Why not make the config files object-oriented? Put the common information in the central config file and have each application config file extend it. You load exactly what you need and you don't rewrite code. Edit: I think this is what arborint was suggesting as well.

Re: Where to store application config?

Posted: Wed Mar 11, 2009 5:38 pm
by pickle
Well it's sounding pretty clear that app-per-app config is the way to go. Thanks for confirming my thoughts.