all working
This commit is contained in:
@@ -1,53 +1,70 @@
|
||||
"""
|
||||
Delphi Consulting Group Database System - Configuration
|
||||
"""
|
||||
from pydantic_settings import BaseSettings
|
||||
from typing import Optional
|
||||
|
||||
from pydantic import Field
|
||||
from pydantic_settings import BaseSettings, SettingsConfigDict
|
||||
|
||||
|
||||
class Settings(BaseSettings):
|
||||
"""Application configuration"""
|
||||
|
||||
"""Application configuration (env and .env driven).
|
||||
|
||||
Environment precedence: real environment variables take priority over .env,
|
||||
which take priority over defaults.
|
||||
"""
|
||||
|
||||
# Application
|
||||
app_name: str = "Delphi Consulting Group Database System"
|
||||
app_version: str = "1.0.0"
|
||||
debug: bool = False
|
||||
|
||||
|
||||
# Database
|
||||
database_url: str = "sqlite:///./data/delphi_database.db"
|
||||
|
||||
# Authentication
|
||||
secret_key: str = "your-secret-key-change-in-production"
|
||||
|
||||
# Authentication / JWT
|
||||
# Require SECRET_KEY to be provided via environment/.env (no insecure default)
|
||||
secret_key: str = Field(..., min_length=32)
|
||||
# Optional previous secret key to allow seamless rotation
|
||||
previous_secret_key: Optional[str] = None
|
||||
algorithm: str = "HS256"
|
||||
access_token_expire_minutes: int = 240 # 4 hours
|
||||
|
||||
# Long-lived refresh token expiration (default 30 days)
|
||||
refresh_token_expire_minutes: int = 43200
|
||||
|
||||
# Admin account settings
|
||||
admin_username: str = "admin"
|
||||
admin_password: str = "change-me"
|
||||
|
||||
|
||||
# File paths
|
||||
upload_dir: str = "./uploads"
|
||||
backup_dir: str = "./backups"
|
||||
|
||||
|
||||
# Pagination
|
||||
default_page_size: int = 50
|
||||
max_page_size: int = 200
|
||||
|
||||
|
||||
# Docker/deployment settings
|
||||
external_port: Optional[str] = None
|
||||
allowed_hosts: Optional[str] = None
|
||||
cors_origins: Optional[str] = None
|
||||
secure_cookies: bool = False
|
||||
compose_project_name: Optional[str] = None
|
||||
|
||||
|
||||
# Logging
|
||||
log_level: str = "INFO"
|
||||
log_to_file: bool = True
|
||||
log_rotation: str = "10 MB"
|
||||
log_retention: str = "30 days"
|
||||
|
||||
class Config:
|
||||
env_file = ".env"
|
||||
|
||||
# pydantic-settings v2 configuration
|
||||
model_config = SettingsConfigDict(
|
||||
env_file=".env",
|
||||
env_prefix="",
|
||||
case_sensitive=False,
|
||||
env_ignore_empty=True,
|
||||
extra="ignore",
|
||||
)
|
||||
|
||||
|
||||
settings = Settings()
|
||||
Reference in New Issue
Block a user