From 2499c7cec546432b5fe94b5d7eae5137872304de Mon Sep 17 00:00:00 2001 From: checktheroads Date: Mon, 20 Jan 2020 10:51:48 -0700 Subject: [PATCH] add development mode config model --- hyperglass/configuration/models/general.py | 1 + manage.py | 20 +++----------------- 2 files changed, 4 insertions(+), 17 deletions(-) diff --git a/hyperglass/configuration/models/general.py b/hyperglass/configuration/models/general.py index 8527d39..f01bf63 100644 --- a/hyperglass/configuration/models/general.py +++ b/hyperglass/configuration/models/general.py @@ -26,6 +26,7 @@ class General(HyperglassModel): """Validation model for params.general.""" debug: StrictBool = False + developer_mode: StrictBool = False primary_asn: StrictStr = "65001" org_name: StrictStr = "The Company" site_title: StrictStr = "hyperglass" diff --git a/manage.py b/manage.py index 0c219de..2d0c03a 100755 --- a/manage.py +++ b/manage.py @@ -605,10 +605,8 @@ def build_ui(): @hg.command("dev-server", help="Start development web server") -@click.option("--host", type=str, required=False, help="Listening IP") -@click.option("--port", type=int, required=False, help="TCP Port") @click.option("-b", "--build", is_flag=True, help="Render Theme & Build Web Assets") -def dev_server(host, port, build): +def dev_server(build): """Renders theme and web build, then starts dev web server""" try: from hyperglass.hyperglass import app, ASGI_PARAMS @@ -617,18 +615,6 @@ def dev_server(host, port, build): click.style("✗ Error importing hyperglass: ", fg="red", bold=True) + click.style(import_error, fg="blue") ) - asgi_params = ASGI_PARAMS.copy() - if host is not None: - asgi_params["host"] = host - if port is not None: - asgi_params["port"] = port - - write_env_variables( - { - "NODE_ENV": "development", - "_HYPERGLASS_URL_": f'http://{asgi_params["host"]}:{asgi_params["port"]}/', - } - ) if build: try: build_complete = build_ui() @@ -638,9 +624,9 @@ def dev_server(host, port, build): + click.style(e, fg="white") ) from None if build_complete: - start_dev_server(app, asgi_params) + start_dev_server(app, ASGI_PARAMS) if not build: - start_dev_server(app, asgi_params) + start_dev_server(app, ASGI_PARAMS) @hg.command("migrate-configs", help="Copy YAML examples to usable config files")