This commit is contained in:
Jörn-Michael Miehe 2022-09-07 11:58:43 +00:00
parent 3170313734
commit 946226c03a
3 changed files with 6 additions and 9 deletions

View file

@ -9,10 +9,7 @@
"type": "python", "type": "python",
"request": "launch", "request": "launch",
"module": "ovdashboard_api.main", "module": "ovdashboard_api.main",
"justMyCode": true, "justMyCode": true
"env": {
"PRODUCTION_MODE": "false"
}
} }
] ]
} }

View file

@ -25,8 +25,8 @@ app = FastAPI(
"url": "https://opensource.org/licenses/mit-license.php", "url": "https://opensource.org/licenses/mit-license.php",
}, },
openapi_url=SETTINGS.openapi_url, openapi_url=SETTINGS.openapi_url,
docs_url=SETTINGS.docs_url if not SETTINGS.production_mode else None, docs_url=SETTINGS.docs_url,
redoc_url=SETTINGS.redoc_url if not SETTINGS.production_mode else None, redoc_url=SETTINGS.redoc_url,
) )
app.include_router(main_router) app.include_router(main_router)

View file

@ -48,14 +48,14 @@ class Settings(BaseSettings):
""" """
production_mode: bool = False production_mode: bool = False
log_level: str = "DEBUG" log_level: str = "INFO" if production_mode else "DEBUG"
cache_seconds: int = 30 cache_seconds: int = 30
cache_size: int = 30 cache_size: int = 30
api_v1_prefix: str = "api/v1" api_v1_prefix: str = "api/v1"
openapi_url: str = "/openapi.json" openapi_url: str = "/openapi.json"
docs_url: Optional[str] = "/docs" docs_url: Optional[str] = None if production_mode else "/docs"
redoc_url: Optional[str] = "/redoc" redoc_url: Optional[str] = None if production_mode else "/redoc"
webdav: DavSettings = DavSettings() webdav: DavSettings = DavSettings()
webdav_retries: int = 20 webdav_retries: int = 20