aboutsummaryrefslogtreecommitdiffstats
path: root/server/config.py
blob: 1fe47f1bda434fc8c5df1967281d0f9b705b3271 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
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

    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")

config = AliasConfig()