Commit 99d9f9e8 authored by Romain Loth's avatar Romain Loth

read servers' hostname from env HOST var

parent 367697ef
......@@ -2,7 +2,11 @@
#
# simple web server running server_comex_registration:app
gunicorn -b 0.0.0.0:9090 \
if [ -z "$HOST" ]
then export HOST="0.0.0.0"
fi
gunicorn -b $HOST:9090 \
--log-level debug \
--access-logfile test_gu_access.log \
--error-logfile test_gu_error.log \
......
......@@ -2,4 +2,8 @@
#
# simple web server running server_comex_registration:app
gunicorn -b 0.0.0.0:9090 server_comex_registration:app
if [ -z "$HOST" ]
then export HOST="0.0.0.0"
fi
gunicorn -b $HOST:9090 server_comex_registration:app
......@@ -24,12 +24,16 @@ from ctypes import c_int32
from jinja2 import Template, Environment, FileSystemLoader
from sqlite3 import connect
from re import sub
from os import environ
# ============= read environ =============
MY_DEBUG_FLAG = ('MY_DEBUG_FLAG' in environ)
MY_HOST = environ.get('HOST', '0.0.0.0')
# ============= app creation =============
app = Flask(__name__)
app.config['DEBUG'] = True
app.config['DEBUG'] = ('MY_DEBUG_FLAG' in environ)
# templating setup
......@@ -216,6 +220,5 @@ def read_records(incoming_data):
########### MAIN ###########
if __name__ == "__main__":
# our app should be bound to an ip (cf. http://stackoverflow.com/a/30329547/2489184)
# TODO read host ip from config
app.run(host='0.0.0.0')
app.run(host=MY_HOST)
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment