71 lines
1.8 KiB
Python
71 lines
1.8 KiB
Python
"""Application configuration using pydantic-settings"""
|
|
|
|
from typing import Optional
|
|
from pydantic_settings import BaseSettings
|
|
from functools import lru_cache
|
|
|
|
|
|
class Settings(BaseSettings):
|
|
"""Main application settings"""
|
|
|
|
# Bot Configuration
|
|
bot_token: str
|
|
bot_admin_id: int
|
|
|
|
# Database Configuration
|
|
database_url: str
|
|
database_echo: bool = False
|
|
|
|
# Database Credentials (for Docker)
|
|
db_password: Optional[str] = None
|
|
db_user: Optional[str] = None
|
|
db_name: Optional[str] = None
|
|
|
|
# Redis Configuration
|
|
redis_url: str = "redis://localhost:6379/0"
|
|
|
|
# Application Configuration
|
|
app_debug: bool = False
|
|
app_env: str = "development"
|
|
log_level: str = "INFO"
|
|
|
|
# API Configuration
|
|
api_host: str = "0.0.0.0"
|
|
api_port: int = 8000
|
|
|
|
# Timezone
|
|
tz: str = "Europe/Moscow"
|
|
|
|
# Security Configuration
|
|
jwt_secret_key: str = "your-secret-key-change-in-production"
|
|
hmac_secret_key: str = "your-hmac-secret-change-in-production"
|
|
require_hmac_verification: bool = False # Disabled by default in MVP
|
|
access_token_expire_minutes: int = 15
|
|
refresh_token_expire_days: int = 30
|
|
|
|
# CORS Configuration
|
|
cors_allowed_origins: list[str] = ["http://localhost:3000", "http://localhost:8081"]
|
|
cors_allow_credentials: bool = True
|
|
cors_allow_methods: list[str] = ["GET", "POST", "PUT", "DELETE", "OPTIONS"]
|
|
cors_allow_headers: list[str] = ["*"]
|
|
|
|
# Feature Flags
|
|
feature_telegram_bot_enabled: bool = True
|
|
feature_transaction_approval: bool = True
|
|
feature_event_logging: bool = True
|
|
|
|
class Config:
|
|
env_file = ".env"
|
|
env_file_encoding = "utf-8"
|
|
case_sensitive = False
|
|
|
|
|
|
@lru_cache()
|
|
def get_settings() -> Settings:
|
|
"""Get cached settings instance"""
|
|
return Settings()
|
|
|
|
|
|
# Global settings instance for direct imports
|
|
settings = get_settings()
|