Added support to configure listen host and port
This commit is contained in:
parent
5a7f09d8b9
commit
a9f4bf18af
1 changed files with 3 additions and 1 deletions
|
|
@ -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()
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue