From 946226c03aea0bb57da8e6cf6e4171bbf818a609 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?J=C3=B6rn-Michael=20Miehe?= <40151420+ldericher@users.noreply.github.com> Date: Wed, 7 Sep 2022 11:58:43 +0000 Subject: [PATCH] settings --- api/.vscode/launch.json | 5 +---- api/ovdashboard_api/main.py | 4 ++-- api/ovdashboard_api/settings.py | 6 +++--- 3 files changed, 6 insertions(+), 9 deletions(-) diff --git a/api/.vscode/launch.json b/api/.vscode/launch.json index a8d8888..8a57e6e 100644 --- a/api/.vscode/launch.json +++ b/api/.vscode/launch.json @@ -9,10 +9,7 @@ "type": "python", "request": "launch", "module": "ovdashboard_api.main", - "justMyCode": true, - "env": { - "PRODUCTION_MODE": "false" - } + "justMyCode": true } ] } \ No newline at end of file diff --git a/api/ovdashboard_api/main.py b/api/ovdashboard_api/main.py index ad909d1..f715f5f 100644 --- a/api/ovdashboard_api/main.py +++ b/api/ovdashboard_api/main.py @@ -25,8 +25,8 @@ app = FastAPI( "url": "https://opensource.org/licenses/mit-license.php", }, openapi_url=SETTINGS.openapi_url, - docs_url=SETTINGS.docs_url if not SETTINGS.production_mode else None, - redoc_url=SETTINGS.redoc_url if not SETTINGS.production_mode else None, + docs_url=SETTINGS.docs_url, + redoc_url=SETTINGS.redoc_url, ) app.include_router(main_router) diff --git a/api/ovdashboard_api/settings.py b/api/ovdashboard_api/settings.py index 92e20d8..5a6ef44 100644 --- a/api/ovdashboard_api/settings.py +++ b/api/ovdashboard_api/settings.py @@ -48,14 +48,14 @@ class Settings(BaseSettings): """ production_mode: bool = False - log_level: str = "DEBUG" + log_level: str = "INFO" if production_mode else "DEBUG" cache_seconds: int = 30 cache_size: int = 30 api_v1_prefix: str = "api/v1" openapi_url: str = "/openapi.json" - docs_url: Optional[str] = "/docs" - redoc_url: Optional[str] = "/redoc" + docs_url: Optional[str] = None if production_mode else "/docs" + redoc_url: Optional[str] = None if production_mode else "/redoc" webdav: DavSettings = DavSettings() webdav_retries: int = 20