From 6ad410339c7a20ef83ecfec7823699521f6cd23b Mon Sep 17 00:00:00 2001 From: deflax Date: Fri, 23 Feb 2018 07:17:21 -0500 Subject: [PATCH] separate config file --- .gitignore | 1 + slavefw.sh | 4 +--- updateipcache.py | 15 +++++++++++++-- 3 files changed, 15 insertions(+), 5 deletions(-) create mode 100644 .gitignore diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..cdd7c19 --- /dev/null +++ b/.gitignore @@ -0,0 +1 @@ +config.sh diff --git a/slavefw.sh b/slavefw.sh index 5f9c623..8d75b2f 100755 --- a/slavefw.sh +++ b/slavefw.sh @@ -1,8 +1,6 @@ #!/bin/bash -PUBIF=ens18 -TRANSPORT_IP="87.120.110.252/24" -TRANSPORT_GW="87.120.110.1" +. /root/frankenrouter/config.sh mkdir -p /root/fr-vlanconf mkdir -p /root/fr-workscripts diff --git a/updateipcache.py b/updateipcache.py index b97756d..eb940d3 100644 --- a/updateipcache.py +++ b/updateipcache.py @@ -3,10 +3,21 @@ import requests import json import sys +import re -slave_name = 'lexx' +conffile = open('/root/frankenrouter/config.sh', 'r') +for line in conffile: + if re.search('LABEL', line): + slave_name = line.split('=', 1)[1].rstrip().replace('"', '') +conffile.close() -api_url = 'https://www.datapoint.bg/vmanager/slavetables' +conffile = open('/root/frankenrouter/config.sh', 'r') +for line in conffile: + if re.search('APIHOST', line): + api_host = line.split('=', 1)[1].rstrip().replace('"', '') +conffile.close() + +api_url = 'https://' + str(api_host) + '/vmanager/slavetables' ###