- Update .env.example and README.md to include new ADMIN_BOOTSTRAP_RESET option for resetting admin credentials on startup. - Modify main.py to implement logic for resetting the admin's password, role, and status if ADMIN_BOOTSTRAP_RESET is set to true. - Adjust config.py to define the new setting, ensuring proper configuration management.
24 lines
893 B
Python
24 lines
893 B
Python
from pydantic_settings import BaseSettings, SettingsConfigDict
|
|
|
|
|
|
class Settings(BaseSettings):
|
|
app_name: str = "TK Wiki Newsletter Admin"
|
|
environment: str = "production"
|
|
secret_key: str = "change-me-in-production"
|
|
algorithm: str = "HS256"
|
|
access_token_expire_minutes: int = 120
|
|
database_url: str = "sqlite:///./data/newsletter.db"
|
|
wiki_api_url: str = "https://www.thomas-krenn.com/de/wikiDE/api.php"
|
|
allowed_hosts: str = "*"
|
|
cookie_secure: bool = False
|
|
admin_bootstrap_email: str = "admin@internal.local"
|
|
admin_bootstrap_password: str = "ChangeMe123!"
|
|
# Wenn true: setzt Passwort/Rolle/Status des Bootstrap-Admins beim Start
|
|
# auf die .env-Werte zurück (auch wenn der User bereits existiert).
|
|
admin_bootstrap_reset: bool = False
|
|
|
|
model_config = SettingsConfigDict(env_file=".env", env_file_encoding="utf-8")
|
|
|
|
|
|
settings = Settings()
|