Files @ e6f9a4843e49
Branch filter:

Location: Morevna/src/config.py

Laman
configurable log path
import os
import json
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(logFile, when="midnight", backupCount=9)
handler.setFormatter(formatter)
logger.addHandler(handler)

certfile=os.path.join(directory,"certs/cert.pem")
keyfile=os.path.join(directory,"certs/key.pem")
peers=os.path.join(directory,"certs/peers.pem")

version=[0,1,1]
lowestCompatible=[0,1,0] # tuple is more fitting but json conversion transforms it into a list anyway

hosts=conf.get("hosts",["127.0.0.1"])
port=conf.get("port",9901)

bSize=conf.get("batchSize",dict())
class batchSize:
	hash=bSize.get("hash",256)
	data=bSize.get("data",64)