Update main.py - configurable listen port

support configuration for listen port. Default to 80 if no configuration
This commit is contained in:
ranlo 2021-09-28 12:49:52 +03:00 committed by GitHub
parent 5c889cd0c6
commit c745f3ce34
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -46,7 +46,13 @@ app.register_blueprint(misc_bp, url_prefix='/api/misc')
app.register_blueprint(update_bp, url_prefix='/api/update')
if __name__ == '__main__':
port = ""
try:
port = int(read_config(("frontend", "http_port")))
except:
port = 80
print(port)
if read_config(("frontend", "remote_access")):
app.run(host="0.0.0.0", port=80)
app.run(host="0.0.0.0", port=port)
else:
app.run(port=80)
app.run(port=port)