Initial commit – TimeMaster Zeiterfassung & HR-Tool
Stand: agent-06 (Audit-Log), agent-05 (Krankmeldung), agent-07 Phase 1 (Personalnummer), Busylight-Pull-Integration, TOTP/2FA, Abwesenheiten, Zeiterfassung, Kiosk-Grundgerüst. Migrations 0001–0023 deployed auf 192.168.1.137 + .164. Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This commit is contained in:
@@ -0,0 +1,54 @@
|
||||
from pydantic_settings import BaseSettings, SettingsConfigDict
|
||||
from pydantic import model_validator
|
||||
from functools import lru_cache
|
||||
|
||||
|
||||
class Settings(BaseSettings):
|
||||
model_config = SettingsConfigDict(env_file=".env", extra="ignore")
|
||||
|
||||
# App
|
||||
app_name: str = "TimeMaster"
|
||||
app_env: str = "development"
|
||||
secret_key: str = "change-me-in-production"
|
||||
frontend_url: str = "http://localhost:5173"
|
||||
allowed_hosts: list[str] = []
|
||||
|
||||
# Database
|
||||
database_url: str = "postgresql+asyncpg://timemaster:secret@localhost:5432/timemaster_db"
|
||||
|
||||
# Redis
|
||||
redis_url: str = "redis://localhost:6379/0"
|
||||
|
||||
# JWT
|
||||
access_token_expire_minutes: int = 30
|
||||
refresh_token_expire_days: int = 30
|
||||
algorithm: str = "HS256"
|
||||
|
||||
# Email
|
||||
resend_api_key: str = ""
|
||||
email_from: str = "noreply@timemaster.app"
|
||||
email_from_name: str = "TimeMaster"
|
||||
|
||||
# First superadmin
|
||||
first_superadmin_email: str = ""
|
||||
first_superadmin_password: str = ""
|
||||
|
||||
@model_validator(mode='after')
|
||||
def validate_secret_key(self):
|
||||
if self.app_env == 'production' and self.secret_key == 'change-me-in-production':
|
||||
raise ValueError('SECRET_KEY must be changed in production! Set SECRET_KEY env variable.')
|
||||
if len(self.secret_key) < 32:
|
||||
raise ValueError('SECRET_KEY must be at least 32 characters long.')
|
||||
return self
|
||||
|
||||
@property
|
||||
def is_production(self) -> bool:
|
||||
return self.app_env == "production"
|
||||
|
||||
|
||||
@lru_cache
|
||||
def get_settings() -> Settings:
|
||||
return Settings()
|
||||
|
||||
|
||||
settings = get_settings()
|
||||
Reference in New Issue
Block a user