From f36272a6c066587a9c787694bfe5f8ac2ba4136f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?J=C3=B6rn-Michael=20Miehe?= <40151420+ldericher@users.noreply.github.com> Date: Fri, 9 Sep 2022 02:41:15 +0000 Subject: [PATCH] some settings renames --- api/ovdashboard_api/async_helpers.py | 2 +- api/ovdashboard_api/routers/__init__.py | 7 +++++-- api/ovdashboard_api/routers/misc.py | 2 +- api/ovdashboard_api/settings.py | 6 +++--- 4 files changed, 10 insertions(+), 7 deletions(-) diff --git a/api/ovdashboard_api/async_helpers.py b/api/ovdashboard_api/async_helpers.py index d765086..1e5f789 100644 --- a/api/ovdashboard_api/async_helpers.py +++ b/api/ovdashboard_api/async_helpers.py @@ -40,7 +40,7 @@ def get_ttl_hash() -> int: https://stackoverflow.com/a/55900800 """ - return round(time() / SETTINGS.cache_seconds) + return round(time() / SETTINGS.cache_time) def timed_alru_cache(*decorator_args, **decorator_kwargs): diff --git a/api/ovdashboard_api/routers/__init__.py b/api/ovdashboard_api/routers/__init__.py index ddba1a0..a45a49e 100644 --- a/api/ovdashboard_api/routers/__init__.py +++ b/api/ovdashboard_api/routers/__init__.py @@ -9,13 +9,16 @@ from fastapi import APIRouter from ..settings import SETTINGS from . import aggregate, calendar, image, misc, text, ticker -main_router = APIRouter(prefix=f"/{SETTINGS.api_v1_prefix}") +main_router = APIRouter(prefix=f"/{SETTINGS.api_prefix}") + +main_router.include_router(misc.router) + main_router.include_router(text.router) main_router.include_router(ticker.router) main_router.include_router(image.router) + main_router.include_router(calendar.router) main_router.include_router(aggregate.router) -main_router.include_router(misc.router) __all__ = [ "main_router", diff --git a/api/ovdashboard_api/routers/misc.py b/api/ovdashboard_api/routers/misc.py index d5b864e..e858d54 100644 --- a/api/ovdashboard_api/routers/misc.py +++ b/api/ovdashboard_api/routers/misc.py @@ -31,7 +31,7 @@ async def get_ip() -> str: ) as s: s.settimeout(0) try: - s.connect((SETTINGS.ping_address, SETTINGS.ping_port)) + s.connect((SETTINGS.ping_host, SETTINGS.ping_port)) IP = s.getsockname()[0] except Exception: diff --git a/api/ovdashboard_api/settings.py b/api/ovdashboard_api/settings.py index 9caf888..0afbf80 100644 --- a/api/ovdashboard_api/settings.py +++ b/api/ovdashboard_api/settings.py @@ -49,14 +49,14 @@ class Settings(BaseSettings): production_mode: bool = False log_level: str = "INFO" if production_mode else "DEBUG" - cache_seconds: int = 30 + cache_time: int = 30 cache_size: int = 30 # doesn't even have to be reachable - ping_address: str = "10.0.0.0" + ping_host: str = "10.0.0.0" ping_port: int = 1 - api_v1_prefix: str = "api/v1" + api_prefix: str = "api/v1" openapi_url: str = "/openapi.json" docs_url: Optional[str] = None if production_mode else "/docs" redoc_url: Optional[str] = None if production_mode else "/redoc"