mirror of
https://github.com/HyPnoTiiK/stream-fusion.git
synced 2026-07-28 23:12:46 +00:00
Introduce a comprehensive settings management system that allows runtime configuration through a new admin interface. The system includes: - Database-backed settings with Redis caching for performance - Settings registry defining types, defaults, and categories - New admin UI with navigation cards and dedicated sub-pages for each category (general, cache, indexers, proxy, system, TMDB) - Shared view logic for consistent GET/POST handling across sub-pages - Automatic seeding of defaults and application of overrides at startup - Validation and type coercion for setting values The previous static configuration page has been replaced with a modular, category-based interface that provides better organization and extensibility for future configuration needs.
27 lines
984 B
Python
27 lines
984 B
Python
import time
|
|
|
|
from sqlalchemy import BigInteger, String, Text
|
|
from sqlalchemy.orm import Mapped, mapped_column
|
|
|
|
from stream_fusion.services.postgresql.base import Base
|
|
|
|
|
|
class AppSettingModel(Base):
|
|
"""Admin-managed overrides for application settings.
|
|
|
|
One row per setting key. Value is stored as UTF-8 text;
|
|
type coercion is handled by SettingsService at read time.
|
|
"""
|
|
|
|
__tablename__ = "app_settings"
|
|
|
|
id: Mapped[int] = mapped_column(BigInteger, primary_key=True, autoincrement=True)
|
|
key: Mapped[str] = mapped_column(String(100), unique=True, nullable=False, index=True)
|
|
value: Mapped[str] = mapped_column(Text, nullable=False)
|
|
updated_at: Mapped[int] = mapped_column(BigInteger, nullable=False)
|
|
updated_by: Mapped[str] = mapped_column(String(100), nullable=False, default="admin")
|
|
|
|
def __init__(self, **kwargs):
|
|
if "updated_at" not in kwargs:
|
|
kwargs["updated_at"] = int(time.time())
|
|
super().__init__(**kwargs)
|