43 lines
1.2 KiB
Python
43 lines
1.2 KiB
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:///./data/family_hub.db"
|
|
|
|
# Security
|
|
SECRET_KEY: str = "your-secret-key-change-this-in-production"
|
|
ALGORITHM: str = "HS256"
|
|
ACCESS_TOKEN_EXPIRE_MINUTES: int = 30
|
|
|
|
# CORS - Allow all origins for development (network access)
|
|
# In production, set this to specific domains in .env file
|
|
ALLOWED_ORIGINS: str = "*"
|
|
|
|
# Environment
|
|
ENVIRONMENT: str = "development"
|
|
|
|
class Config:
|
|
env_file = ".env"
|
|
case_sensitive = True
|
|
|
|
@property
|
|
def cors_origins(self) -> List[str]:
|
|
"""Parse ALLOWED_ORIGINS into a list."""
|
|
# Allow all origins if set to "*"
|
|
if self.ALLOWED_ORIGINS == "*":
|
|
return ["*"]
|
|
|
|
if isinstance(self.ALLOWED_ORIGINS, str):
|
|
return [origin.strip() for origin in self.ALLOWED_ORIGINS.split(',')]
|
|
return self.ALLOWED_ORIGINS
|
|
|
|
settings = Settings()
|