Files
bakery-ia/services/auth/app/core/config.py

57 lines
2.0 KiB
Python
Raw Normal View History

2025-07-19 21:44:52 +02:00
# ================================================================
# AUTH SERVICE CONFIGURATION
# services/auth/app/core/config.py
# ================================================================
"""
Authentication service configuration
2025-07-19 21:44:52 +02:00
User management and JWT token handling
"""
2025-07-19 21:44:52 +02:00
from shared.config.base import BaseServiceSettings
import os
2025-07-19 21:44:52 +02:00
class AuthSettings(BaseServiceSettings):
"""Auth service specific settings"""
2025-07-19 21:44:52 +02:00
# Service Identity
APP_NAME: str = "Authentication Service"
2025-07-19 21:44:52 +02:00
SERVICE_NAME: str = "auth-service"
DESCRIPTION: str = "User authentication and authorization service"
2025-07-19 21:44:52 +02:00
# Database Configuration
DATABASE_URL: str = os.getenv("AUTH_DATABASE_URL",
"postgresql+asyncpg://auth_user:auth_pass123@auth-db:5432/auth_db")
2025-07-19 21:44:52 +02:00
# Redis Database (dedicated for auth)
REDIS_DB: int = 0
2025-07-19 21:44:52 +02:00
# Enhanced Password Requirements for Spain
PASSWORD_MIN_LENGTH: int = 8
PASSWORD_REQUIRE_UPPERCASE: bool = True
PASSWORD_REQUIRE_LOWERCASE: bool = True
PASSWORD_REQUIRE_NUMBERS: bool = True
PASSWORD_REQUIRE_SYMBOLS: bool = False
2025-07-19 21:44:52 +02:00
# Spanish GDPR Compliance
GDPR_COMPLIANCE_ENABLED: bool = True
DATA_RETENTION_DAYS: int = int(os.getenv("AUTH_DATA_RETENTION_DAYS", "365"))
CONSENT_REQUIRED: bool = True
PRIVACY_POLICY_URL: str = os.getenv("PRIVACY_POLICY_URL", "/privacy")
# Account Security
ACCOUNT_LOCKOUT_ENABLED: bool = True
MAX_LOGIN_ATTEMPTS: int = 5
LOCKOUT_DURATION_MINUTES: int = 30
2025-07-19 21:44:52 +02:00
PASSWORD_HISTORY_COUNT: int = 5
2025-07-19 21:44:52 +02:00
# Session Management
SESSION_TIMEOUT_MINUTES: int = int(os.getenv("SESSION_TIMEOUT_MINUTES", "60"))
CONCURRENT_SESSIONS_LIMIT: int = int(os.getenv("CONCURRENT_SESSIONS_LIMIT", "3"))
2025-07-19 21:44:52 +02:00
# Email Verification
EMAIL_VERIFICATION_REQUIRED: bool = os.getenv("EMAIL_VERIFICATION_REQUIRED", "true").lower() == "true"
EMAIL_VERIFICATION_EXPIRE_HOURS: int = int(os.getenv("EMAIL_VERIFICATION_EXPIRE_HOURS", "24"))
2025-07-19 21:44:52 +02:00
settings = AuthSettings()