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

exarkun at twistedmatrix.com exarkun at twistedmatrix.com
Wed Aug 8 16:13:09 EDT 2012

On 01:58 pm, _ at lvh.cc wrote:
>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 
>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

This doesn't really seem like a Twisted question... but...

axiom is my favorite configuration persistence tool.
>Like I said, I currently use (1), it looks like (1) and (2) are more or 
>less equivalent, I'm not sure if (3) is a good idea. I'm not really 
>unhappy with (1), it's just that finally writing my ServiceMaker class 
>made me contemplate the options.
>(3) has the downside that it conflates user data with configuration 
>data. I'm not sure that's a good thing or not. It sounds very similar 
>to axiomatic, which I've heard of, seen, but never played with.

It doesn't conflate user data with configuration data any more than any 
other system.  Keep a database for your configuration and keep your user 
data somewhere else (perhaps in a separate axiom store).

>I already use environment variables to decide whether or not to run 
>certain tests ("live" functional high level tests, with real disk and 
>network IO, that take way longer than the unit tests to run). I'm going 
>to keep it that way, because there's no obvious way of passing 
>configuration to the tests other than the environment.
>Twisted-Python mailing list
>Twisted-Python at twistedmatrix.com

More information about the Twisted-Python mailing list