Updated feature / fix

This commit is contained in:
Niranjan
2026-04-07 03:35:32 +05:30
parent ca6142c39a
commit 3492c441ee
3 changed files with 39 additions and 12 deletions

View File

@@ -1,15 +1,26 @@
"""YakPanel - Configuration"""
import os
from typing import Any
from pydantic_settings import BaseSettings
from functools import lru_cache
from pathlib import Path
from typing import Any
from pydantic_settings import BaseSettings, SettingsConfigDict
# Runtime config loaded from DB on startup (overrides Settings)
_runtime_config: dict[str, Any] = {}
_BACKEND_ROOT = Path(__file__).resolve().parent.parent
class Settings(BaseSettings):
"""Application settings"""
model_config = SettingsConfigDict(
env_file=str(_BACKEND_ROOT / ".env"),
env_file_encoding="utf-8",
extra="ignore",
)
app_name: str = "YakPanel"
app_version: str = "1.0.0"
debug: bool = False
@@ -47,10 +58,6 @@ class Settings(BaseSettings):
# Comma-separated CIDRs; empty = no restriction (e.g. "10.0.0.0/8,192.168.0.0/16")
remote_install_allowed_target_cidrs: str = ""
class Config:
env_file = ".env"
env_file_encoding = "utf-8"
@lru_cache
def get_settings() -> Settings: