From a9f4bf18af4ecd2a32baefc5b7bdd277988933d3 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=C3=93scar=20Garc=C3=ADa=20Amor?= Date: Sat, 12 Mar 2016 13:45:45 +0100 Subject: [PATCH] Added support to configure listen host and port --- bin/srv.py | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/bin/srv.py b/bin/srv.py index 809b3a5..f19625f 100644 --- a/bin/srv.py +++ b/bin/srv.py @@ -25,6 +25,8 @@ app = Flask(__name__) MYDIR = os.environ.get('WTTR_MYDIR', os.path.abspath(os.path.dirname( os.path.dirname('__file__') ))) GEOLITE = os.environ.get('WTTR_GEOLITE', os.path.join( MYDIR, "GeoLite2-City.mmdb" )) WEGO = os.environ.get('WTTR_WEGO', "/home/igor/go/bin/wego") +LISTEN_HOST = os.environ.get('WTTR_LISTEN_HOST', "127.0.0.1") +LISTEN_PORT = int(os.environ.get('WTTR_LISTEN_PORT', "8002")) CACHEDIR = os.path.join( MYDIR, "cache" ) IP2LCACHE = os.path.join( MYDIR, "cache/ip2l" ) @@ -260,6 +262,6 @@ def wttr(location = None): logging.error("Exception has occured", exc_info=1) return str(e).rstrip()+"\n" -server = WSGIServer(("", 8002), app) +server = WSGIServer((LISTEN_HOST, LISTEN_PORT), app) server.serve_forever()