[Twisted-Python] twisted server config: command line, environment or Axiom?

Kevin Horn kevin.horn at gmail.com
Wed Aug 8 14:06:07 EDT 2012

On Wed, Aug 8, 2012 at 8:58 AM, Laurens Van Houtven <_ at lvh.cc> wrote:

> Hi,
> I have a bunch of configuration for my service. Things like endpoints,
> location of the root axiom store… Right now I grab these from the
> environment. That means that my twistd IServiceMaker plugin's options is
> pretty much by definition empty.
> I'm wondering if more mature twistd users have already learned the hard
> way what the best way to manage this is. I see three possible solutions:
> 1. environment variables as I use them now: portable, simple.
> 2. command line options: still pretty portable and simple. additional
> benefit: easy discoverability of options
> 3. axiom store: has the benefit that there's a single source of truth for
> everything, i.e. I copy a store and I can recreate the service based on
> that store exactly, using just the store
Never, ever store config data and user data in the same place.  Likewise,
if you're going to persist config data, it should be in some kind of plain
text format.

1) and 2) are fine, though I prefer a simple text file format as well, and
I like to have multiple levels of configuration which are overridable.

one or more config files (maybe in /etc, in /home/<user>, the pwd) which
override each other in a specified manner, which are in turn overridable by
command line options and/or env vars

whether any of this is appropriate for your case, and how much complexity
you need obviously depends on your application

Kevin Horn
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://twistedmatrix.com/pipermail/twisted-python/attachments/20120808/81a21f15/attachment.htm 

More information about the Twisted-Python mailing list