diff --git a/src/config.py b/src/config.py --- a/src/config.py +++ b/src/config.py @@ -1,4 +1,5 @@ import os +import json import logging as log from logging.handlers import TimedRotatingFileHandler @@ -10,15 +11,19 @@ handler=TimedRotatingFileHandler("/var/l handler.setFormatter(formatter) logger.addHandler(handler) - -version=0 - -hosts=["127.0.0.1"] -port=9901 - directory=os.path.join(os.path.dirname(__file__),"..") certfile=os.path.join(directory,"certs/cert.pem") keyfile=os.path.join(directory,"certs/key.pem") peers=os.path.join(directory,"certs/peers.pem") -batchSize=256 +configFile=os.path.join(directory,"config.json") +conf=dict() +if os.path.isfile(configFile): + with open(configFile) as f: conf=json.load(f) + +version=0 + +hosts=conf.get("hosts",["127.0.0.1"]) +port=conf.get("port",9901) + +batchSize=conf.get("batchSize",256)