import os import sys from pydantic_settings import BaseSettings, SettingsConfigDict class Settings(BaseSettings): model_config = SettingsConfigDict(env_file='.env', extra='ignore') DATABASE_URL: str = "sqlite:///app/mywebdav.db" REDIS_URL: str = "redis://redis:6379/0" SECRET_KEY: str = "super_secret_key" ALGORITHM: str = "HS256" ACCESS_TOKEN_EXPIRE_MINUTES: int = 30 REFRESH_TOKEN_EXPIRE_DAYS: int = 7 DOMAIN_NAME: str = "MyWebdav.eu" CERTBOT_EMAIL: str = "admin@example.com" STORAGE_PATH: str = "storage" S3_ACCESS_KEY_ID: str | None = None S3_SECRET_ACCESS_KEY: str | None = None S3_ENDPOINT_URL: str | None = None S3_BUCKET_NAME: str = "mywebdav-storage" SMTP_HOST: str = "mail.example.com" SMTP_PORT: int = 587 SMTP_USERNAME: str = "noreply@example.com" SMTP_PASSWORD: str = "your-smtp-password" SMTP_USE_TLS: bool = True SMTP_SENDER_EMAIL: str = "noreply@example.com" TOTP_ISSUER: str = "MyWebdav" STRIPE_SECRET_KEY: str = "" STRIPE_PUBLISHABLE_KEY: str = "" STRIPE_WEBHOOK_SECRET: str = "" BILLING_ENABLED: bool = False settings = Settings() if settings.SECRET_KEY == "super_secret_key" and os.getenv("ENVIRONMENT") == "production": print("ERROR: Secret key must be changed in production. Set SECRET_KEY environment variable.") sys.exit(1)