Improve base config
This commit is contained in:
@@ -1,32 +1,70 @@
|
||||
# ================================================================
|
||||
# TENANT SERVICE CONFIGURATION
|
||||
# services/tenant/app/core/config.py
|
||||
# ================================================================
|
||||
|
||||
"""
|
||||
uLutenant service configuration
|
||||
Tenant service configuration
|
||||
Multi-tenant management and subscription handling
|
||||
"""
|
||||
|
||||
from shared.config.base import BaseServiceSettings
|
||||
import os
|
||||
from pydantic_settings import BaseSettings
|
||||
|
||||
class Settings(BaseSettings):
|
||||
"""Application settings"""
|
||||
class TenantSettings(BaseServiceSettings):
|
||||
"""Tenant service specific settings"""
|
||||
|
||||
# Basic settings
|
||||
APP_NAME: str = "uLutenant Service"
|
||||
VERSION: str = "1.0.0"
|
||||
DEBUG: bool = os.getenv("DEBUG", "False").lower() == "true"
|
||||
LOG_LEVEL: str = os.getenv("LOG_LEVEL", "INFO")
|
||||
# Service Identity
|
||||
APP_NAME: str = "Tenant Service"
|
||||
SERVICE_NAME: str = "tenant-service"
|
||||
DESCRIPTION: str = "Multi-tenant management and subscription service"
|
||||
|
||||
# Database settings
|
||||
DATABASE_URL: str = os.getenv("DATABASE_URL", "postgresql+asyncpg://tenant_user:tenant_pass123@tenant-db:5432/tenant_db")
|
||||
# Database Configuration
|
||||
DATABASE_URL: str = os.getenv("TENANT_DATABASE_URL",
|
||||
"postgresql+asyncpg://tenant_user:tenant_pass123@tenant-db:5432/tenant_db")
|
||||
|
||||
# Redis settings
|
||||
REDIS_URL: str = os.getenv("REDIS_URL", "redis://redis:6379/0")
|
||||
# Redis Database (dedicated for tenant data)
|
||||
REDIS_DB: int = 4
|
||||
|
||||
# RabbitMQ settings
|
||||
RABBITMQ_URL: str = os.getenv("RABBITMQ_URL", "amqp://bakery:forecast123@rabbitmq:5672/")
|
||||
# Subscription Plans
|
||||
DEFAULT_PLAN: str = os.getenv("DEFAULT_PLAN", "basic")
|
||||
TRIAL_PERIOD_DAYS: int = int(os.getenv("TRIAL_PERIOD_DAYS", "14"))
|
||||
|
||||
# Service URLs
|
||||
AUTH_SERVICE_URL: str = os.getenv("AUTH_SERVICE_URL", "http://auth-service:8000")
|
||||
# Plan Limits
|
||||
BASIC_PLAN_LOCATIONS: int = int(os.getenv("BASIC_PLAN_LOCATIONS", "1"))
|
||||
BASIC_PLAN_PREDICTIONS_PER_DAY: int = int(os.getenv("BASIC_PLAN_PREDICTIONS_PER_DAY", "100"))
|
||||
BASIC_PLAN_DATA_RETENTION_DAYS: int = int(os.getenv("BASIC_PLAN_DATA_RETENTION_DAYS", "90"))
|
||||
|
||||
class Config:
|
||||
env_file = ".env"
|
||||
PREMIUM_PLAN_LOCATIONS: int = int(os.getenv("PREMIUM_PLAN_LOCATIONS", "5"))
|
||||
PREMIUM_PLAN_PREDICTIONS_PER_DAY: int = int(os.getenv("PREMIUM_PLAN_PREDICTIONS_PER_DAY", "1000"))
|
||||
PREMIUM_PLAN_DATA_RETENTION_DAYS: int = int(os.getenv("PREMIUM_PLAN_DATA_RETENTION_DAYS", "365"))
|
||||
|
||||
ENTERPRISE_PLAN_LOCATIONS: int = int(os.getenv("ENTERPRISE_PLAN_LOCATIONS", "50"))
|
||||
ENTERPRISE_PLAN_PREDICTIONS_PER_DAY: int = int(os.getenv("ENTERPRISE_PLAN_PREDICTIONS_PER_DAY", "10000"))
|
||||
ENTERPRISE_PLAN_DATA_RETENTION_DAYS: int = int(os.getenv("ENTERPRISE_PLAN_DATA_RETENTION_DAYS", "1095"))
|
||||
|
||||
# Billing Configuration
|
||||
BILLING_ENABLED: bool = os.getenv("BILLING_ENABLED", "false").lower() == "true"
|
||||
BILLING_CURRENCY: str = os.getenv("BILLING_CURRENCY", "EUR")
|
||||
BILLING_CYCLE_DAYS: int = int(os.getenv("BILLING_CYCLE_DAYS", "30"))
|
||||
|
||||
# Resource Limits
|
||||
MAX_API_CALLS_PER_MINUTE: int = int(os.getenv("MAX_API_CALLS_PER_MINUTE", "100"))
|
||||
MAX_STORAGE_MB: int = int(os.getenv("MAX_STORAGE_MB", "1024"))
|
||||
MAX_CONCURRENT_REQUESTS: int = int(os.getenv("MAX_CONCURRENT_REQUESTS", "10"))
|
||||
|
||||
# Spanish Business Configuration
|
||||
SPANISH_TAX_RATE: float = float(os.getenv("SPANISH_TAX_RATE", "0.21")) # IVA 21%
|
||||
INVOICE_LANGUAGE: str = os.getenv("INVOICE_LANGUAGE", "es")
|
||||
SUPPORT_EMAIL: str = os.getenv("SUPPORT_EMAIL", "soporte@bakeryforecast.es")
|
||||
|
||||
# Onboarding
|
||||
ONBOARDING_ENABLED: bool = os.getenv("ONBOARDING_ENABLED", "true").lower() == "true"
|
||||
DEMO_DATA_ENABLED: bool = os.getenv("DEMO_DATA_ENABLED", "true").lower() == "true"
|
||||
|
||||
# Compliance
|
||||
GDPR_COMPLIANCE_ENABLED: bool = True
|
||||
DATA_EXPORT_ENABLED: bool = True
|
||||
DATA_DELETION_ENABLED: bool = True
|
||||
|
||||
settings = Settings()
|
||||
settings = TenantSettings()
|
||||
|
||||
Reference in New Issue
Block a user