summaryrefslogtreecommitdiffstats
path: root/gui/odr-dabmux-gui.py
diff options
context:
space:
mode:
authorMatthias P. Braendli <matthias.braendli@mpb.li>2015-12-13 18:35:25 +0100
committerMatthias P. Braendli <matthias.braendli@mpb.li>2015-12-13 18:35:25 +0100
commit1318dab05f3c3b6c471e4919596744e889562034 (patch)
tree7ae2ecc693c769057c43e3da43706a4229289d03 /gui/odr-dabmux-gui.py
parent8ec05409b48181aec03119c2fb01fa1377d4837b (diff)
parent1ebd4c9030827857eb0c7f665324e18ceefbe1f5 (diff)
downloaddabmux-1318dab05f3c3b6c471e4919596744e889562034.tar.gz
dabmux-1318dab05f3c3b6c471e4919596744e889562034.tar.bz2
dabmux-1318dab05f3c3b6c471e4919596744e889562034.zip
Merge remote-tracking branch 'yoann/next' into next
Fixes munin script and adds gui improvements
Diffstat (limited to 'gui/odr-dabmux-gui.py')
-rwxr-xr-xgui/odr-dabmux-gui.py22
1 files changed, 17 insertions, 5 deletions
diff --git a/gui/odr-dabmux-gui.py b/gui/odr-dabmux-gui.py
index caa4ea7..85098f8 100755
--- a/gui/odr-dabmux-gui.py
+++ b/gui/odr-dabmux-gui.py
@@ -31,7 +31,7 @@ from muxconfig import *
from bottle import route, run, template, static_file, request
import json
-conf = ConfigurationHandler('localhost')
+import argparse
@route('/config')
def config():
@@ -63,7 +63,7 @@ def config_json_post():
return template('configeditor',
version = conf.get_mux_version(),
- config = conf.get_full_configuration(),
+ config = json.dumps(conf.get_full_configuration(), indent=4),
message = successmessage)
@route('/config.json', method="GET")
@@ -73,8 +73,8 @@ def config_json_get():
conf.load()
- return {'version': conf.get_mux_version(),
- 'config': conf.get_full_configuration()}
+ return { 'version': conf.get_mux_version(),
+ 'config': conf.get_full_configuration() }
@route('/')
@@ -112,5 +112,17 @@ def stats_json():
def send_static(filename):
return static_file(filename, root='./static')
-run(host='localhost', port=8000, debug=True, reloader=True)
+
+if __name__ == '__main__':
+ # Get configuration file in argument
+ parser = argparse.ArgumentParser(description='management server for ODR-DabMux')
+ parser.add_argument('--host', default='127.0.0.1', help='socket host (default: 127.0.0.1)',required=False)
+ parser.add_argument('--port', default='8000', help='socket port (default: 8000)',required=False)
+ parser.add_argument('--mhost', default='127.0.0.1', help='mux host (default: 127.0.0.1)',required=False)
+ parser.add_argument('--mport', default='12720', help='mux port (default: 12720)',required=False)
+ cli_args = parser.parse_args()
+
+ conf = ConfigurationHandler(cli_args.mhost, cli_args.mport)
+
+ run(host=cli_args.host, port=int(cli_args.port), debug=True, reloader=False)