morethanadiagnosis-hub/backend/app/config.py
admin 48e8de6cd6 fix: allow extra environment variables in Settings config
Pydantic Settings now ignores extra env vars like db_user, db_password, redis_password.

Job ID: MTAD-IMPL-2025-11-18-CL
2025-11-18 07:04:40 +00:00

87 lines
2.1 KiB
Python

"""
Application configuration using Pydantic Settings.
Job ID: MTAD-IMPL-2025-11-18-CL
"""
from typing import List
from pydantic_settings import BaseSettings
class Settings(BaseSettings):
"""Application settings loaded from environment variables."""
# Environment
env: str = "development"
debug: bool = False
# API
api_version: str = "v1"
api_title: str = "MoreThanADiagnosis API"
api_description: str = "Community Hub for Chronically/Terminally Ill Individuals"
# Database
database_url: str = "sqlite:///./test.db"
database_pool_size: int = 20
database_max_overflow: int = 10
# Security
secret_key: str = "change-me-in-production"
algorithm: str = "HS256"
access_token_expire_minutes: int = 15
refresh_token_expire_days: int = 30
password_hashing_algorithm: str = "argon2"
# CORS
cors_origins: List[str] = [
"https://morethanadiagnosis.com",
"http://localhost:3000",
"http://localhost:8081",
]
cors_credentials: bool = True
cors_methods: List[str] = ["*"]
cors_headers: List[str] = ["*"]
# Logging
log_level: str = "INFO"
log_format: str = "json"
# Observability
jaeger_enabled: bool = False
jaeger_host: str = "localhost"
jaeger_port: int = 6831
# Rate Limiting
rate_limit_enabled: bool = True
rate_limit_requests: int = 100
rate_limit_period: int = 60
# Redis
redis_url: str = "redis://localhost:6379/0"
# Email
smtp_server: str = "smtp.gmail.com"
smtp_port: int = 587
smtp_username: str = "noreply@morethanadiagnosis.com"
smtp_password: str = ""
smtp_from: str = "noreply@morethanadiagnosis.com"
# File Storage
storage_type: str = "s3"
s3_bucket: str = "morethanadiagnosis-media"
s3_region: str = "us-east-1"
s3_access_key: str = ""
s3_secret_key: str = ""
# Feature Flags
feature_mfa_enabled: bool = True
feature_social_login_enabled: bool = False
feature_pseudonym_enabled: bool = True
class Config:
env_file = ".env"
case_sensitive = False
extra = "ignore"
settings = Settings()