Fix read config
This commit is contained in:
parent
fa4fcfd0e3
commit
9315157f2f
3 changed files with 31 additions and 5 deletions
|
|
@ -1,4 +1,9 @@
|
||||||
import yaml
|
import yaml
|
||||||
|
import sys
|
||||||
|
|
||||||
|
if len(sys.argv) != 2:
|
||||||
|
print("You need to pass the easyconfig.cfg path")
|
||||||
|
exit(1)
|
||||||
|
|
||||||
|
|
||||||
def defaults(custom):
|
def defaults(custom):
|
||||||
|
|
@ -94,7 +99,8 @@ backend srv_{1}_{0}
|
||||||
return result
|
return result
|
||||||
|
|
||||||
|
|
||||||
parsed = yaml.load("/etc/easyconfig/easyconfig.cfg")
|
with open(sys.argv[1], 'r') as content_file:
|
||||||
|
parsed = yaml.load(content_file.read())
|
||||||
|
|
||||||
print(defaults(parsed["customerrors"] if "customerrors" in parsed else False))
|
print(defaults(parsed["customerrors"] if "customerrors" in parsed else False))
|
||||||
if "stats" in parsed:
|
if "stats" in parsed:
|
||||||
|
|
|
||||||
|
|
@ -12,16 +12,18 @@ echo " __/ | __/ |"
|
||||||
echo " |___/ |___/ "
|
echo " |___/ |___/ "
|
||||||
echo ""
|
echo ""
|
||||||
|
|
||||||
if [ ! -f "/etc/easyconfig/easyconfig.cfg" ]
|
HAPROXY_CFG="/etc/haproxy/haproxy.cfg"
|
||||||
|
EASYCONFIG_CFG="/etc/easyconfig/easyconfig.cfg"
|
||||||
|
|
||||||
|
if [ ! -f "$EASYCONFIG_CFG" ]
|
||||||
then
|
then
|
||||||
echo "File '/etc/easyconfig/easyconfig.cfg' does not exist"
|
echo "File '$EASYCONFIG_CFG' does not exist"
|
||||||
exit 1
|
exit 1
|
||||||
fi
|
fi
|
||||||
|
|
||||||
|
|
||||||
HAPROXY_CFG="/etc/haproxy/haproxy.cfg"
|
|
||||||
|
|
||||||
python3 /entrypoint.py > $HAPROXY_CFG
|
python3 /entrypoint.py "$EASYCONFIG_CFG" > $HAPROXY_CFG
|
||||||
|
|
||||||
|
|
||||||
/sbin/syslogd -O /proc/1/fd/1
|
/sbin/syslogd -O /proc/1/fd/1
|
||||||
|
|
|
||||||
18
example.yml
Normal file
18
example.yml
Normal file
|
|
@ -0,0 +1,18 @@
|
||||||
|
stats:
|
||||||
|
username: admin
|
||||||
|
password: senha
|
||||||
|
port: 1936
|
||||||
|
|
||||||
|
customerrors: true
|
||||||
|
|
||||||
|
easymapping:
|
||||||
|
- port: 80
|
||||||
|
hosts:
|
||||||
|
host1.com.br: container:5000
|
||||||
|
host2.com.br: other:3000
|
||||||
|
redirect:
|
||||||
|
www.host1.com.br: http://host1.com.br
|
||||||
|
|
||||||
|
- port: 8080
|
||||||
|
hosts:
|
||||||
|
host3.com.br: domain:8181
|
||||||
Loading…
Add table
Add a link
Reference in a new issue