45 lines
1.4 KiB
Python
Raw Normal View History

2025-11-09 23:29:07 +01:00
import os
2025-11-10 15:46:40 +01:00
import sys
2025-11-09 23:29:07 +01:00
from pydantic_settings import BaseSettings, SettingsConfigDict
2025-11-13 23:22:05 +01:00
2025-11-09 23:29:07 +01:00
class Settings(BaseSettings):
2025-11-13 23:22:05 +01:00
model_config = SettingsConfigDict(env_file=".env", extra="ignore")
2025-11-09 23:29:07 +01:00
2025-11-13 12:05:05 +01:00
DATABASE_URL: str = "sqlite:///app/mywebdav.db"
2025-11-09 23:29:07 +01:00
REDIS_URL: str = "redis://redis:6379/0"
2025-11-10 15:46:40 +01:00
SECRET_KEY: str = "super_secret_key"
2025-11-09 23:29:07 +01:00
ALGORITHM: str = "HS256"
ACCESS_TOKEN_EXPIRE_MINUTES: int = 30
REFRESH_TOKEN_EXPIRE_DAYS: int = 7
2025-11-13 12:05:05 +01:00
DOMAIN_NAME: str = "MyWebdav.eu"
2025-11-09 23:29:07 +01:00
CERTBOT_EMAIL: str = "admin@example.com"
2025-11-10 15:46:40 +01:00
STORAGE_PATH: str = "storage"
2025-11-09 23:29:07 +01:00
S3_ACCESS_KEY_ID: str | None = None
S3_SECRET_ACCESS_KEY: str | None = None
S3_ENDPOINT_URL: str | None = None
2025-11-13 12:05:05 +01:00
S3_BUCKET_NAME: str = "mywebdav-storage"
2025-11-11 15:20:14 +01:00
SMTP_HOST: str = "mail.example.com"
2025-11-10 15:46:40 +01:00
SMTP_PORT: int = 587
2025-11-11 15:20:14 +01:00
SMTP_USERNAME: str = "noreply@example.com"
SMTP_PASSWORD: str = "your-smtp-password"
SMTP_USE_TLS: bool = True
SMTP_SENDER_EMAIL: str = "noreply@example.com"
2025-11-13 12:05:05 +01:00
TOTP_ISSUER: str = "MyWebdav"
2025-11-10 15:46:40 +01:00
STRIPE_SECRET_KEY: str = ""
STRIPE_PUBLISHABLE_KEY: str = ""
STRIPE_WEBHOOK_SECRET: str = ""
BILLING_ENABLED: bool = False
2025-11-09 23:29:07 +01:00
2025-11-13 23:22:05 +01:00
2025-11-09 23:29:07 +01:00
settings = Settings()
2025-11-10 15:46:40 +01:00
2025-11-13 23:22:05 +01:00
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."
)
2025-11-10 15:46:40 +01:00
sys.exit(1)