From 374b2adb8a7ee55c5cad87955add772096f73999 Mon Sep 17 00:00:00 2001 From: Thibaut Horel Date: Sat, 20 Nov 2010 22:54:01 +0100 Subject: Add config file feature. New -c switch to specify a config file on the command line. See config.ini.sample for an example of a config file. The configuration options can then be shared across modules : just import config module. --- config.py | 15 +++++++++++++++ 1 file changed, 15 insertions(+) create mode 100644 config.py (limited to 'config.py') diff --git a/config.py b/config.py new file mode 100644 index 0000000..d50d4d7 --- /dev/null +++ b/config.py @@ -0,0 +1,15 @@ +import ConfigParser + +filename = None + +class AliasConfigParser(ConfigParser.RawConfigParser): + + def read(self, filenames): + ConfigParser.RawConfigParser.read(self, filenames) + self.name = self.get("component", "name") + self.root = self.get("component", "root") + self.host = self.get("component", "host") + self.secret = self.get("component", "secret") + self.port = self.getint("component", "port") + +config = AliasConfigParser() -- cgit v1.2.3-70-g09d2