summaryrefslogtreecommitdiff
path: root/src/server.py
diff options
context:
space:
mode:
Diffstat (limited to 'src/server.py')
-rwxr-xr-x[-rw-r--r--]src/server.py17
1 files changed, 16 insertions, 1 deletions
diff --git a/src/server.py b/src/server.py
index 2caddd6..37fcb51 100644..100755
--- a/src/server.py
+++ b/src/server.py
@@ -2,6 +2,7 @@
# vim: shiftwidth=4 tabstop=4 expandtab
+import configparser
import waitress
from flask import Flask
@@ -14,8 +15,22 @@ def index():
return app.send_static_file("index.html")
+def load_config():
+ """Load ./config.ini File and read web-template Section"""
+
+ retval = {}
+
+ config = configparser.ConfigParser()
+ config.read("config.ini")
+ for option in config.options("web-template"):
+ retval[option] = config.get("web-template", option)
+
+ return retval # dictionary with all options from web-template section
+
+
if __name__ == '__main__':
- waitress.serve(app, listen="127.0.0.1:8080") # production server / bind to port
+ config = load_config()
+ waitress.serve(app, listen="{}:{}".format(config["address"], config["port"])) # production server / bind to port
#serve(app, unix_socket='/run/web-template/unix.sock') # production server / unix domain socket
#app.run() # debug server - NOT FOR PRODUCTION!