Files
ppr-ng/backend/app/core/config.py
2025-12-19 08:33:42 -05:00

48 lines
1.1 KiB
Python

from pydantic_settings import BaseSettings
from typing import Optional
class Settings(BaseSettings):
# Database settings
db_host: str = "db" # Docker service name
db_user: str
db_password: str
db_name: str
db_port: int = 3306
# Security settings
secret_key: str
algorithm: str = "HS256"
access_token_expire_minutes: int = 30
# Mail settings
mail_host: str
mail_port: int = 465
mail_username: str
mail_password: str
mail_from: str
mail_from_name: str
# Application settings
api_v1_str: str = "/api/v1"
project_name: str = "Airfield PPR API"
base_url: str
# UI Configuration
tag: str = ""
top_bar_base_color: str = "#2c3e50"
environment: str = "production" # production, development, staging, etc.
# Redis settings (for future use)
redis_url: Optional[str] = None
class Config:
env_file = ".env"
case_sensitive = False
@property
def database_url(self) -> str:
return f"mysql+pymysql://{self.db_user}:{self.db_password}@{self.db_host}:{self.db_port}/{self.db_name}"
settings = Settings()