use Config.ticker_separator value

This commit is contained in:
Jörn-Michael Miehe 2022-09-04 23:58:45 +00:00
parent ea462b7459
commit 972551d170
3 changed files with 6 additions and 4 deletions

View file

@ -50,7 +50,6 @@ class ImageConfig(BaseModel):
class Config(BaseModel):
ticker_separator: str = " +++ "
cache_seconds: int = 30
image: ImageConfig = ImageConfig()

View file

@ -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()
)

View file

@ -31,7 +31,6 @@ class Settings(BaseSettings):
dav_password: str = "changeme"
dav_path: str = "ovdashboard"
ticker_separator: str = " +++ "
cache_seconds: int = 30
@property