# HG changeset patch # User Laman # Date 2017-10-31 20:05:49 # Node ID ffd985ff1ae6aec42e8eed92635a882555050a3d # Parent 9f2b0a4f3538dcc90633e26ee0ae65644a20ce88 configuration loaded from a configuration file diff --git a/.hgignore b/.hgignore --- a/.hgignore +++ b/.hgignore @@ -1,3 +1,4 @@ /__pycache__/ ^\..* ^certs/ +^config.json diff --git a/config.json b/config.json new file mode 100644 --- /dev/null +++ b/config.json @@ -0,0 +1,5 @@ +{ + "hosts": ["127.0.0.1"], + "port": 9021, + "batchSize": 256 +} 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) diff --git a/src/morevna.sh b/src/morevna.sh --- a/src/morevna.sh +++ b/src/morevna.sh @@ -18,5 +18,7 @@ sudo umount /dev/mapper/ext2luks sudo cryptsetup close ext2luks sudo losetup -d /dev/loop0 +echo + python morevna.py build ~/ext2.bin ~/ext2.img -python morevna.py push --host 10.0.0.33 --tree ~/ext2.bin ~/ext2.img +python morevna.py push --tree ~/ext2.bin ~/ext2.img