Add a config option for the messaging system

Signed-off-by: Petr Šabata <contyk@redhat.com>
This commit is contained in:
Petr Šabata
2016-06-28 15:08:13 +02:00
parent 009475e18d
commit 482c57ee07
2 changed files with 15 additions and 0 deletions

View File

@@ -1,5 +1,6 @@
[DEFAULT]
system = koji
messaging = fedmsg
koji = http://koji.stg.fedoraproject.org/kojihub
db = sqlite:///rida.db
pdc = http://pdc.stg.fedoraproject.org/

View File

@@ -48,6 +48,7 @@ def from_file(filename=None):
conf = Config()
conf.db = default.get("db")
conf.system = default.get("system")
conf.messaging = default.get("messaging")
conf.pdc = default.get("pdc")
conf.koji = default.get("koji")
conf.scmurls = json.loads(default.get("scmurls"))
@@ -59,6 +60,7 @@ class Config(object):
def __init__(self):
"""Initialize the Config object."""
self._system = ""
self._messaging = ""
self._db = ""
self._pdc = ""
self._koji = ""
@@ -75,6 +77,18 @@ class Config(object):
raise ValueError("Unsupported buildsystem.")
self._system = s
@property
def messaging(self):
"""The messaging system to use."""
return self._messaging
@messaging.setter
def messaging(self, s):
s = str(s)
if s not in ("fedmsg"):
raise ValueError("Unsupported messaging system.")
self._messaging = s
@property
def db(self):
"""RDB URL."""