-
Notifications
You must be signed in to change notification settings - Fork 0
/
config.py
44 lines (31 loc) · 1.12 KB
/
config.py
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
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
import ConfigParser
CONFIG_FILE = './ci-scoreboard.conf'
CONFIG_SECTION = 'scoreboard'
class Config:
def __init__(self):
self._cfg = ConfigParser.ConfigParser()
self._cfg.read(CONFIG_FILE)
def _value(self, option):
if self._cfg.has_option(CONFIG_SECTION, option):
return self._cfg.get(CONFIG_SECTION, option)
return None
def _int_value(self, option):
if self._cfg.has_option(CONFIG_SECTION, option):
return self._cfg.getint(CONFIG_SECTION, option)
return None
def _float_value(self, option):
if self._cfg.has_option(CONFIG_SECTION, option):
return self._cfg.getfloat(CONFIG_SECTION, option)
return None
def gerrit_user(self):
return self._value('GERRIT_USER')
def gerrit_key(self):
return self._value('GERRIT_KEY')
def gerrit_hostname(self):
return self._value('GERRIT_HOSTNAME')
def gerrit_port(self):
return self._int_value('GERRIT_PORT')
def db_uri(self):
return self._value('DB_URI')
def log_file(self):
return self._value('LOG_FILE_LOCATION')