From 972551d170a7d24b22f5f901787219a53fda2cc9 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?J=C3=B6rn-Michael=20Miehe?= <40151420+ldericher@users.noreply.github.com> Date: Sun, 4 Sep 2022 23:58:45 +0000 Subject: [PATCH] use Config.ticker_separator value --- api/ovdashboard_api/config.py | 1 - api/ovdashboard_api/routers/text.py | 8 ++++++-- api/ovdashboard_api/settings.py | 1 - 3 files changed, 6 insertions(+), 4 deletions(-) diff --git a/api/ovdashboard_api/config.py b/api/ovdashboard_api/config.py index 3e213ac..83e61a4 100644 --- a/api/ovdashboard_api/config.py +++ b/api/ovdashboard_api/config.py @@ -50,7 +50,6 @@ class ImageConfig(BaseModel): class Config(BaseModel): ticker_separator: str = " +++ " - cache_seconds: int = 30 image: ImageConfig = ImageConfig() diff --git a/api/ovdashboard_api/routers/text.py b/api/ovdashboard_api/routers/text.py index 2b426ab..683a250 100644 --- a/api/ovdashboard_api/routers/text.py +++ b/api/ovdashboard_api/routers/text.py @@ -4,7 +4,7 @@ from typing import Iterator from fastapi import APIRouter, Depends from markdown import markdown -from ..settings import SETTINGS +from ..config import Config from ..dav_file import DavFile from ._common import FileNameLister, PrefixFinder, PrefixUnique @@ -46,8 +46,12 @@ async def get_ticker_content_lines( async def get_ticker_content( ticker_content_lines: Iterator[str] = Depends(get_ticker_content_lines), ) -> str: + cfg = await Config.get() + ticker_content_lines = ["", *ticker_content_lines, ""] + ticker_content = cfg.ticker_separator.join(ticker_content_lines) + return markdown( - SETTINGS.ticker_separator.join(ticker_content_lines) + ticker_content.strip() ) diff --git a/api/ovdashboard_api/settings.py b/api/ovdashboard_api/settings.py index b55f4f2..8cd9aaf 100644 --- a/api/ovdashboard_api/settings.py +++ b/api/ovdashboard_api/settings.py @@ -31,7 +31,6 @@ class Settings(BaseSettings): dav_password: str = "changeme" dav_path: str = "ovdashboard" - ticker_separator: str = " +++ " cache_seconds: int = 30 @property