[Baypiggies] configuration parser using python modules?
david at bitcasa.com
Fri Jul 13 21:09:30 CEST 2012
I think James inadvertently summed up what should be in a config file.
stuff. Things like API keys that rarely if ever change. Paths to logs,
external services. For those items, a non-language specific config file
a single configuration usable by multiple services within the same
Not every service/app may need everything in the file, but it makes it easy
keep the settings consistent between maybe a web app written in Python,
pub-sub stuff written in JS on Node and maybe some desktop application
in the case of deploying a desktop application, you may not want all your
the config in case you expose some internal sensitive info).
In other cases, you may be supporting some legacy code in say Java, and
replacing parts in Python. Again, a non-language specific config file
the old and new code to have a consistent configuration.
On Fri, Jul 13, 2012 at 11:53 AM, James Tatum <jtatum at gmail.com> wrote:
> One of my pet peeves is using config files for things that really
> should be in code. It's a peculiar habit which seems very prevalent in
> areas like test frameworks where people often create massive XML
> configuration schemas. Not only is XML a terrible config file format
> (when the config file is meant to be written by humans), but using
> most any static config file is abandoning the expressiveness possible
> in code. Examples of configuration type things that are simple to do
> in code include conditionals, loops, variable substitution, and being
> able to encode any needed value or data type simply and easily.
> On Fri, Jul 13, 2012 at 9:26 AM, Aleksandr Miroslav
> <alexmiroslav at gmail.com> wrote:
> > This may be obvious to people, but not to me, so I have to ask.
> > Instead of using ConfigurationParser, why not have a configuration file
> > be imported as a module, so this way, the variables could be part of the
> > module's namespace.
> > I know people have mentioned users running arbitrary code as a reason
> > for why this should not be done, aside from this, is there any other
> > reason? Is there a way to prevent users from running arbitrary code?
> > _______________________________________________
> > Baypiggies mailing list
> > Baypiggies at python.org
> > To change your subscription options or unsubscribe:
> > http://mail.python.org/mailman/listinfo/baypiggies
> Baypiggies mailing list
> Baypiggies at python.org
> To change your subscription options or unsubscribe:
-------------- next part --------------
An HTML attachment was scrubbed...
More information about the Baypiggies