Move getConfig to a helper class
This commit is contained in:
parent
1fbcec3931
commit
92b9692304
|
@ -64,7 +64,8 @@ class BaseFactory(Factory):
|
||||||
else:
|
else:
|
||||||
return
|
return
|
||||||
|
|
||||||
def getConfig():
|
class Helper(object):
|
||||||
|
def getConfig(self):
|
||||||
with open("config.json", "r") as f:
|
with open("config.json", "r") as f:
|
||||||
config = load(f)
|
config = load(f)
|
||||||
if set(["port", "bind", "usessl"]).issubset(set(config.keys())):
|
if set(["port", "bind", "usessl"]).issubset(set(config.keys())):
|
||||||
|
@ -76,7 +77,8 @@ def getConfig():
|
||||||
error("Mandatory values missing from config")
|
error("Mandatory values missing from config")
|
||||||
|
|
||||||
if __name__ == "__main__":
|
if __name__ == "__main__":
|
||||||
config = getConfig()
|
helper = Helper()
|
||||||
|
config = helper.getConfig()
|
||||||
|
|
||||||
listener = BaseFactory()
|
listener = BaseFactory()
|
||||||
if config["usessl"] == True:
|
if config["usessl"] == True:
|
||||||
|
|
Loading…
Reference in New Issue