35 lines
1006 B
Python
35 lines
1006 B
Python
"""Application configuration."""
|
|
from pydantic_settings import BaseSettings
|
|
from typing import List
|
|
|
|
class Settings(BaseSettings):
|
|
"""Application settings."""
|
|
|
|
APP_NAME: str = "Family Hub"
|
|
APP_VERSION: str = "0.1.0"
|
|
DEBUG: bool = True
|
|
|
|
# Database
|
|
DATABASE_URL: str = "sqlite:///./family_hub.db"
|
|
|
|
# Security
|
|
SECRET_KEY: str = "your-secret-key-change-this-in-production"
|
|
ALGORITHM: str = "HS256"
|
|
ACCESS_TOKEN_EXPIRE_MINUTES: int = 30
|
|
|
|
# CORS - accepts either comma-separated string or JSON array
|
|
ALLOWED_ORIGINS: str = "http://localhost:5173,http://localhost:3000"
|
|
|
|
class Config:
|
|
env_file = ".env"
|
|
case_sensitive = True
|
|
|
|
@property
|
|
def cors_origins(self) -> List[str]:
|
|
"""Parse ALLOWED_ORIGINS into a list."""
|
|
if isinstance(self.ALLOWED_ORIGINS, str):
|
|
return [origin.strip() for origin in self.ALLOWED_ORIGINS.split(',')]
|
|
return self.ALLOWED_ORIGINS
|
|
|
|
settings = Settings()
|