From bed341f59d8558155462918901d06cb66d7e56ed Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Rodrigo=20Ram=C3=ADrez=20Norambuena?= Date: Fri, 23 Sep 2016 15:38:44 -0300 Subject: [PATCH] add host option for web command: This enable set the ip address where listen the web app --- docs/usage.rst | 2 ++ storm/__main__.py | 5 +++-- storm/web.py | 5 +++-- 3 files changed, 8 insertions(+), 4 deletions(-) diff --git a/docs/usage.rst b/docs/usage.rst index 46452e7..b4f0ff0 100644 --- a/docs/usage.rst +++ b/docs/usage.rst @@ -146,6 +146,8 @@ you can also use the web ui instead of commandline interface:: $ storm web $ storm web 3333 $ storm web --debug + $ storm web --host 0.0.0.0 .. versionchanged:: 0.7 *--port* option was removed. *--debug* option is now defaults to ``False``. + *--host* option was added. diff --git a/storm/__main__.py b/storm/__main__.py index 7f0b323..aceafb9 100644 --- a/storm/__main__.py +++ b/storm/__main__.py @@ -295,12 +295,13 @@ def backup(target_file, config=None): @command('web') @arg('port', nargs='?', default=9002, type=int) +@arg('host', nargs='?', default="127.0.0.1", type=str) @arg('theme', nargs='?', default="modern", choices=['modern', 'black', 'storm']) @arg('debug', action='store_true', default=False) -def web(port, debug=False, theme="modern", ssh_config=None): +def web(port, host="127.0.0.1", debug=False, theme="modern", ssh_config=None): """Starts the web UI.""" from storm import web as _web - _web.run(port, debug, theme, ssh_config) + _web.run(host, port, debug, theme, ssh_config) if __name__ == '__main__': diff --git a/storm/web.py b/storm/web.py index 2661d90..f664a05 100644 --- a/storm/web.py +++ b/storm/web.py @@ -104,10 +104,11 @@ def favicon(): mimetype='image/vnd.microsoft.icon') -def run(port, debug, theme, ssh_config=None): +def run(host, port, debug, theme, ssh_config=None): global __THEME__ port = int(port) debug = bool(debug) + host = str(host) __THEME__ = theme def get_storm(): @@ -115,4 +116,4 @@ def get_storm(): app.get_storm = get_storm - app.run(port=port, debug=debug) + app.run(host=host, port=port, debug=debug)