From cc54e1dddf460d7015272b771dcee61b09f1d308 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?J=C3=B6rn-Michael=20Miehe?= Date: Tue, 31 Oct 2023 20:27:50 +0100 Subject: [PATCH] show "redis" settings in ConfigView --- api/advent22_api/core/settings.py | 8 ++++++++ api/advent22_api/routers/admin.py | 2 ++ ui/src/components/admin/ConfigView.vue | 9 +++++++++ ui/src/lib/api.ts | 1 + 4 files changed, 20 insertions(+) diff --git a/api/advent22_api/core/settings.py b/api/advent22_api/core/settings.py index c509978..04c3ea5 100644 --- a/api/advent22_api/core/settings.py +++ b/api/advent22_api/core/settings.py @@ -41,6 +41,14 @@ class RedisSettings(BaseModel): db: int = 0 protocol: int = 3 + @property + def url(self) -> str: + """ + Combined DAV URL. + """ + + return f"redis_v{self.protocol}://{self.host}:{self.port}/db_{self.db}" + class Settings(BaseSettings): """ diff --git a/api/advent22_api/routers/admin.py b/api/advent22_api/routers/admin.py index 70fb6fd..26928fe 100644 --- a/api/advent22_api/routers/admin.py +++ b/api/advent22_api/routers/admin.py @@ -48,6 +48,7 @@ class ConfigModel(BaseModel): puzzle: __Puzzle calendar: __Calendar image: Image + redis_url: str webdav: __WebDAV @@ -82,6 +83,7 @@ async def get_config_model( "background": cal_cfg.background, }, "image": cfg.image, + "redis_url": SETTINGS.redis.url, "webdav": { "url": SETTINGS.webdav.url, "cache_ttl": SETTINGS.webdav.cache_ttl, diff --git a/ui/src/components/admin/ConfigView.vue b/ui/src/components/admin/ConfigView.vue index 012c9da..21d9b17 100644 --- a/ui/src/components/admin/ConfigView.vue +++ b/ui/src/components/admin/ConfigView.vue @@ -132,6 +132,14 @@
Konfigurationsdatei
{{ config_model.webdav.config_file }}
+ + + +
+

Sonstige

+
+
Redis
+
{{ config_model.redis_url }}
UI-Admin
@@ -191,6 +199,7 @@ export default class extends Vue { border: 0, fonts: [{ file: "consetetur", size: 0 }], }, + redis_url: "sadipscing elitr", webdav: { url: "sadipscing elitr", cache_ttl: 0, diff --git a/ui/src/lib/api.ts b/ui/src/lib/api.ts index a2a808c..5da1534 100644 --- a/ui/src/lib/api.ts +++ b/ui/src/lib/api.ts @@ -21,6 +21,7 @@ export interface ConfigModel { border: number; fonts: { file: string; size: number }[]; }; + redis_url: string; webdav: { url: string; cache_ttl: number;