aboutsummaryrefslogtreecommitdiffstats
path: root/server/config.py
diff options
context:
space:
mode:
Diffstat (limited to 'server/config.py')
-rw-r--r--server/config.py36
1 files changed, 13 insertions, 23 deletions
diff --git a/server/config.py b/server/config.py
index 1fe47f1..74befe2 100644
--- a/server/config.py
+++ b/server/config.py
@@ -1,28 +1,18 @@
import ConfigParser
-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
+class AliasConfigParser(ConfigParser.SafeConfigParser):
def read(self, filename):
- 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")
+ ConfigParser.SafeConfigParser.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")
+ if self.has_option("component", "logfile"):
+ self.logfile = self.get("component", "logfile")
+ if self.has_option("component", "pidfile"):
+ self.pidfile = self.get("component", "pidfile")
-config = AliasConfig() \ No newline at end of file
+config = AliasConfigParser()