1
#!/usr/bin/python
2
3
# Read Mouchak Configuration
4
5
6
import re
7
8
def readConfig():
9
    confFile = 'mouchak.conf'
10
    fh = open(confFile, 'r')
11
    contents = fh.read()
12
13
    match = re.search('DB=(.*)', contents)
14
    dbName = match.group(1)
15
    match = re.search('SITE_TITLE=(.*)', contents)
16
    title = match.group(1)
17
    match = re.search('HOST=(.*)', contents)
18
    host = match.group(1)
19
    match = re.search('PORT=(.*)', contents)
20
    port = match.group(1)
21
22
    return {'db': dbName, 'site_title': title, 'host': host, 'port': int(port)}