Files
CMT/backend/app/core/config.py
T
linmihigo c086f64363 feat: implement complete CMT backend with API endpoints and test suite
- Add 7 core API endpoints: users, transactions, partners, products, inventory, payments, credit
- Implement role-based authentication (admin/write/read-only access)
- Add comprehensive database models with proper relationships
- Include full test coverage for all endpoints and business logic
- Set up Alembic migrations and Docker configuration
- Configure FastAPI app with CORS and database integration
2025-09-14 21:04:07 +02:00

33 lines
901 B
Python

from pydantic import (
PostgresDsn
)
from pydantic_settings import BaseSettings, SettingsConfigDict
class Settings(BaseSettings):
"""
Application settings loaded from environment variables.
"""
database_uri: PostgresDsn
environment: str
project_name: str
# JWT settings
secret_key: str = "your-secret-key-change-this-in-production"
algorithm: str = "HS256"
# Role-based expiration times (in minutes)
admin_token_expire_minutes: int = 60 * 24 * 7 # 7 days (default)
write_token_expire_minutes: int = 60 * 24 * 3 # 3 days (default)
read_only_token_expire_minutes: int = 60 * 8 # 8 hours (default)
model_config = SettingsConfigDict(
# One level above ./backend
env_file='../.env',
env_ignore_empty=True,
extra='ignore'
)
api_v1_str: str = "/api/v1"
settings = Settings() # type: ignore