From a97c5f45859cf6178a74f3f0936b7a2954a345c7 Mon Sep 17 00:00:00 2001 From: Carl Allen Date: Sun, 16 Jul 2017 14:31:45 -0500 Subject: [PATCH] Allow setting port by param --- run.py | 9 +++++++-- update/3_port_config.sql | 1 + 2 files changed, 8 insertions(+), 2 deletions(-) create mode 100644 update/3_port_config.sql diff --git a/run.py b/run.py index e077587e..79ea7d5c 100755 --- a/run.py +++ b/run.py @@ -1,6 +1,11 @@ #!/usr/bin/env python -from modules import socketio, app +from modules import socketio, app, cbpi -socketio.run(app, host='0.0.0.0') +try: + port = int(cbpi.get_config_parameter('port', '5000')) +except ValueError: + port = 5000 + +socketio.run(app, host='0.0.0.0', port=port) diff --git a/update/3_port_config.sql b/update/3_port_config.sql new file mode 100644 index 00000000..8d102fdb --- /dev/null +++ b/update/3_port_config.sql @@ -0,0 +1 @@ +INSERT OR IGNORE INTO config VALUES ('port', 5000, 'number', 'Port to run server (requires restart)', NULL );