Browse Source

Whoops, need to read the config outside of main for gunicorn

Kirk Trombley 5 years ago
parent
commit
45f0db2917
1 changed files with 5 additions and 4 deletions
  1. 5 4
      app.py

+ 5 - 4
app.py

@@ -16,6 +16,11 @@ REFRESH_RATE = 60 # seconds
 app = Flask(__name__)
 CORS(app)
 
+with open("secret.toml") as infile:
+    cfg = toml.load(infile)
+for k in ("host", "port", "user", "pass"):
+    app.config[k] = cfg[k]
+
 
 def parse_ts_response(response):
     # entries separated by |'s
@@ -162,8 +167,4 @@ def message_audiobot():
 
 
 if __name__ == "__main__":
-    with open("secret.toml") as infile:
-        cfg = toml.load(infile)
-    for k in ("host", "port", "user", "pass"):
-        app.config[k] = cfg[k]
     app.run("0.0.0.0", 5000, debug=True, threaded=True)