mirror of
https://code.lenaisten.de/Lenaisten/advent22.git
synced 2024-11-23 00:03:07 +00:00
RedisSettings
This commit is contained in:
parent
63b9f4e1d9
commit
367fef145d
4 changed files with 19 additions and 14 deletions
|
@ -41,14 +41,6 @@ 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):
|
||||
"""
|
||||
|
|
|
@ -8,7 +8,7 @@ from advent22_api.core.helpers import EventDates
|
|||
from ..core.calendar_config import CalendarConfig, DoorsSaved, get_calendar_config
|
||||
from ..core.config import Config, Image, get_config
|
||||
from ..core.depends import get_all_event_dates, get_all_image_names, get_all_parts
|
||||
from ..core.settings import SETTINGS
|
||||
from ..core.settings import SETTINGS, RedisSettings
|
||||
from ._security import require_admin, user_is_admin
|
||||
|
||||
router = APIRouter(prefix="/admin", tags=["admin"])
|
||||
|
@ -48,7 +48,7 @@ class ConfigModel(BaseModel):
|
|||
puzzle: __Puzzle
|
||||
calendar: __Calendar
|
||||
image: Image
|
||||
redis_url: str
|
||||
redis: RedisSettings
|
||||
webdav: __WebDAV
|
||||
|
||||
|
||||
|
@ -83,7 +83,7 @@ async def get_config_model(
|
|||
"background": cal_cfg.background,
|
||||
},
|
||||
"image": cfg.image,
|
||||
"redis_url": SETTINGS.redis.url,
|
||||
"redis": SETTINGS.redis,
|
||||
"webdav": {
|
||||
"url": SETTINGS.webdav.url,
|
||||
"cache_ttl": SETTINGS.webdav.cache_ttl,
|
||||
|
|
|
@ -139,7 +139,10 @@
|
|||
<h3>Sonstige</h3>
|
||||
<dl>
|
||||
<dt>Redis</dt>
|
||||
<dd>{{ config_model.redis_url }}</dd>
|
||||
<dd>Host: {{ config_model.redis.host }}</dd>
|
||||
<dd>Port: {{ config_model.redis.port }}</dd>
|
||||
<dd>Datenbank: {{ config_model.redis.db }}</dd>
|
||||
<dd>Protokoll: {{ config_model.redis.protocol }}</dd>
|
||||
|
||||
<dt>UI-Admin</dt>
|
||||
<dd class="is-family-monospace">
|
||||
|
@ -199,7 +202,12 @@ export default class extends Vue {
|
|||
border: 0,
|
||||
fonts: [{ file: "consetetur", size: 0 }],
|
||||
},
|
||||
redis_url: "sadipscing elitr",
|
||||
redis: {
|
||||
host: "0.0.0.0",
|
||||
port: 6379,
|
||||
db: 0,
|
||||
protocol: 3,
|
||||
},
|
||||
webdav: {
|
||||
url: "sadipscing elitr",
|
||||
cache_ttl: 0,
|
||||
|
|
|
@ -21,7 +21,12 @@ export interface ConfigModel {
|
|||
border: number;
|
||||
fonts: { file: string; size: number }[];
|
||||
};
|
||||
redis_url: string;
|
||||
redis: {
|
||||
host: string;
|
||||
port: number;
|
||||
db: number;
|
||||
protocol: number;
|
||||
};
|
||||
webdav: {
|
||||
url: string;
|
||||
cache_ttl: number;
|
||||
|
|
Loading…
Reference in a new issue