diff options
Diffstat (limited to 'server/config.py')
| -rw-r--r-- | server/config.py | 34 |
1 files changed, 23 insertions, 11 deletions
diff --git a/server/config.py b/server/config.py index ab9be52..1fe47f1 100644 --- a/server/config.py +++ b/server/config.py @@ -1,16 +1,28 @@ import ConfigParser -class AliasConfigParser(ConfigParser.RawConfigParser): +class AliasConfig(object): + def __init__(self): + self.name = None + self.root = None + self.host = None + self.secret = None + self.port = None + self.background = None + self.logfile = None + self.pidfile = None def read(self, filename): - ConfigParser.RawConfigParser.read(self, filename) - 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") - self.background = self.getboolean("component", "background") - self.logfile = self.get("component", "logfile") - self.pidfile = self.get("component", "pidfile") + config = ConfigParser.SafeConfigParser() + config.read(filename) + self.name = config.get("component", "name") + self.root = config.get("component", "root") + self.host = config.get("component", "host") + self.secret = config.get("component", "secret") + self.port = config.getint("component", "port") + self.background = config.getboolean("component", "background") + if config.has_option("component", "logfile"): + self.logfile = config.get("component", "logfile") + if config.has_option("component", "pidfile"): + self.pidfile = config.get("component", "pidfile") -config = AliasConfigParser() +config = AliasConfig()
\ No newline at end of file |
