Files
@ 5c80ca07f00c
Branch filter:
Location: Morevna/src/config.py - annotation
5c80ca07f00c
1.1 KiB
text/x-python
reformatted whitespace with more respect for PEP-8
cd2ba192bf12 ffd985ff1ae6 7cfb47330e47 259f29140f23 7cfb47330e47 7cfb47330e47 e6f9a4843e49 e6f9a4843e49 e6f9a4843e49 e6f9a4843e49 e6f9a4843e49 e6f9a4843e49 e6f9a4843e49 e6f9a4843e49 5c80ca07f00c 3f9fff4c9811 5c80ca07f00c e6f9a4843e49 3f9fff4c9811 3f9fff4c9811 3f9fff4c9811 5c80ca07f00c 5c80ca07f00c 5c80ca07f00c 7d21dd70864a 5c80ca07f00c 5c80ca07f00c ffd985ff1ae6 5c80ca07f00c 5c80ca07f00c ffd985ff1ae6 5c80ca07f00c 0b67ddd4455a 5c80ca07f00c 5c80ca07f00c | 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)
|