Changeset - ffd985ff1ae6
[Not reviewed]
default
0 3 1
Laman - 7 years ago 2017-10-31 20:05:49

configuration loaded from a configuration file
4 files changed with 21 insertions and 8 deletions:
0 comments (0 inline, 0 general)
.hgignore
Show inline comments
 
/__pycache__/
 
^\..*
 
^certs/
 
^config.json
config.json
Show inline comments
 
new file 100644
 
{
 
	"hosts": ["127.0.0.1"],
 
	"port": 9021,
 
	"batchSize": 256
 
}
src/config.py
Show inline comments
 
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)
src/morevna.sh
Show inline comments
 
@@ -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
0 comments (0 inline, 0 general)