fix telegram
This commit is contained in:
39
deploy-package-20260223-151231/shared/utils/config.py
Normal file
39
deploy-package-20260223-151231/shared/utils/config.py
Normal file
@@ -0,0 +1,39 @@
|
||||
"""
|
||||
Configurări comune pentru toate aplicațiile ROA2WEB
|
||||
"""
|
||||
import os
|
||||
from typing import List, Dict, Any
|
||||
from pydantic import BaseSettings
|
||||
|
||||
class SharedConfig(BaseSettings):
|
||||
"""Configurări partajate între microservicii"""
|
||||
|
||||
# Database
|
||||
oracle_user: str = os.getenv('ORACLE_USER', '')
|
||||
oracle_password: str = os.getenv('ORACLE_PASSWORD', '')
|
||||
oracle_dsn: str = os.getenv('ORACLE_DSN', '')
|
||||
|
||||
# Database Pool
|
||||
db_min_connections: int = int(os.getenv('DB_MIN_CONNECTIONS', 2))
|
||||
db_max_connections: int = int(os.getenv('DB_MAX_CONNECTIONS', 10))
|
||||
db_connection_increment: int = int(os.getenv('DB_CONNECTION_INCREMENT', 1))
|
||||
|
||||
# JWT Authentication
|
||||
jwt_secret_key: str = os.getenv('JWT_SECRET_KEY', 'your-super-secret-jwt-key-change-in-production')
|
||||
jwt_algorithm: str = os.getenv('JWT_ALGORITHM', 'HS256')
|
||||
access_token_expire_minutes: int = int(os.getenv('ACCESS_TOKEN_EXPIRE_MINUTES', 30))
|
||||
refresh_token_expire_days: int = int(os.getenv('REFRESH_TOKEN_EXPIRE_DAYS', 7))
|
||||
|
||||
# Authentication Settings
|
||||
auth_cache_ttl_minutes: int = int(os.getenv('AUTH_CACHE_TTL_MINUTES', 15))
|
||||
rate_limit_max_requests: int = int(os.getenv('RATE_LIMIT_MAX_REQUESTS', 5))
|
||||
rate_limit_time_window: int = int(os.getenv('RATE_LIMIT_TIME_WINDOW', 300))
|
||||
|
||||
# Logging
|
||||
log_level: str = os.getenv('LOG_LEVEL', 'INFO')
|
||||
|
||||
class Config:
|
||||
env_file = '.env'
|
||||
|
||||
# Instance globală
|
||||
shared_config = SharedConfig()
|
||||
27
deploy-package-20260223-151231/shared/utils/exceptions.py
Normal file
27
deploy-package-20260223-151231/shared/utils/exceptions.py
Normal file
@@ -0,0 +1,27 @@
|
||||
"""
|
||||
Exception handlers comune pentru ROA2WEB
|
||||
"""
|
||||
from typing import Any, Dict, Optional
|
||||
|
||||
class ROAException(Exception):
|
||||
"""Exception de bază pentru aplicațiile ROA"""
|
||||
def __init__(self, message: str, details: Optional[Dict[str, Any]] = None):
|
||||
self.message = message
|
||||
self.details = details or {}
|
||||
super().__init__(self.message)
|
||||
|
||||
class DatabaseException(ROAException):
|
||||
"""Excepții legate de baza de date"""
|
||||
pass
|
||||
|
||||
class AuthenticationException(ROAException):
|
||||
"""Excepții legate de autentificare"""
|
||||
pass
|
||||
|
||||
class AuthorizationException(ROAException):
|
||||
"""Excepții legate de autorizare"""
|
||||
pass
|
||||
|
||||
class ValidationException(ROAException):
|
||||
"""Excepții legate de validare date"""
|
||||
pass
|
||||
Reference in New Issue
Block a user