diff --git a/config/config.yaml b/config/config.yaml index c0d9aac..0f0d050 100644 --- a/config/config.yaml +++ b/config/config.yaml @@ -3,6 +3,7 @@ Server: port: 8000 scheme: http cors: False + enable_ui: True static_folder: ui/ Database: diff --git a/poetry.lock b/poetry.lock index 0e98888..aa43ec3 100644 --- a/poetry.lock +++ b/poetry.lock @@ -1136,4 +1136,4 @@ watchdog = ["watchdog (>=2.3)"] [metadata] lock-version = "2.0" python-versions = "^3.10" -content-hash = "cdbbaa8d1f22a904c7cc3fa51f5fbaf5f19a99f2f5fd9715adfe7abf766b05f0" +content-hash = "64cb750d8d7e5ad3e10d7f53f311971c09849247b0ea3d82a66a7f368837f63f" diff --git a/shortenit/web.py b/shortenit/web.py index c4a63e8..179c50a 100644 --- a/shortenit/web.py +++ b/shortenit/web.py @@ -31,16 +31,17 @@ class Web: CORS(self.app) def setup_routes(self): - self.app.add_url_rule( - "/", "/", self.handler.index, methods=["GET"], defaults={"path": ""} - ) - self.app.add_url_rule("/", "/", self.handler.index, methods=["GET"]) - self.app.add_url_rule( - "/static/css/", "css", self.handler.css, methods=["GET"] - ) - self.app.add_url_rule( - "/static/js/", "js", self.handler.js, methods=["GET"] - ) + if self.handler.configuration.get("Server", None)["enable_ui"]: + self.app.add_url_rule( + "/", "/", self.handler.index, methods=["GET"], defaults={"path": ""} + ) + self.app.add_url_rule("/", "/", self.handler.index, methods=["GET"]) + self.app.add_url_rule( + "/static/css/", "css", self.handler.css, methods=["GET"] + ) + self.app.add_url_rule( + "/static/js/", "js", self.handler.js, methods=["GET"] + ) self.app.add_url_rule( "/api/v1/shorten", "shorten", self.handler.shortenit, methods=["POST"] )