diff --git a/src/config.py b/src/config.py --- a/src/config.py +++ b/src/config.py @@ -4,23 +4,25 @@ import logging as log from logging.handlers import TimedRotatingFileHandler +directory = os.path.join(os.path.dirname(__file__), "..") +configFile = os.path.join(directory, "config.json") +conf = dict() +if os.path.isfile(configFile): + with open(configFile) as f: conf = json.load(f) + +logFile = conf.get("logFile", "/var/log/morevna/mor.log") + logger=log.getLogger() logger.setLevel(log.INFO) formatter=log.Formatter("%(asctime)s %(levelname)s: %(message)s",datefmt="%Y-%m-%d %H:%M:%S") -handler=TimedRotatingFileHandler("/var/log/morevna/mor.log",when="midnight",backupCount=9) +handler = TimedRotatingFileHandler(logFile, when="midnight", backupCount=9) handler.setFormatter(formatter) logger.addHandler(handler) -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") -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,1,1] lowestCompatible=[0,1,0] # tuple is more fitting but json conversion transforms it into a list anyway