Files
@ e3c116b7dc5c
Branch filter:
Location: Morevna/src/config.py - annotation
e3c116b7dc5c
1.0 KiB
text/x-python
bugfix: really recover from a failed ssl connection
cd2ba192bf12 ffd985ff1ae6 7cfb47330e47 259f29140f23 7cfb47330e47 7cfb47330e47 259f29140f23 3f9fff4c9811 3f9fff4c9811 3f9fff4c9811 3f9fff4c9811 3f9fff4c9811 3f9fff4c9811 cd2ba192bf12 08a31c3a463d 08a31c3a463d 08a31c3a463d 7d21dd70864a ffd985ff1ae6 ffd985ff1ae6 ffd985ff1ae6 ffd985ff1ae6 ffd985ff1ae6 4f3ff4c311f2 87a9ced6e7b5 ffd985ff1ae6 ffd985ff1ae6 ffd985ff1ae6 ffd985ff1ae6 0b67ddd4455a 0b67ddd4455a 0b67ddd4455a 0b67ddd4455a | import os
import json
import logging as log
from logging.handlers import TimedRotatingFileHandler
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.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
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)
|