Files
booking-service/app/config.py

53 lines
1.4 KiB
Python

from pydantic_settings import BaseSettings
from functools import lru_cache
class Settings(BaseSettings):
# Database
database_url: str = "postgresql://booking:booking2026@db:5432/booking"
# App
app_name: str = "BookingService"
app_url: str = "https://booking.scan360.app"
api_key: str = "changeme"
cors_origins: list[str] = ["https://farmaciaianni.it", "http://localhost:3000"]
# Google OAuth
google_client_id: str = ""
google_client_secret: str = ""
google_redirect_uri: str = "https://booking.scan360.app/auth/callback"
allowed_domains: str = "kitzanos.com,farmaciaianni.it"
# JWT
jwt_secret: str = "xab-booking-jwt-secret-2026"
jwt_algorithm: str = "HS256"
jwt_expire_hours: int = 24
# Google Calendar
google_credentials_json: str = ""
# Notifications
smtp_host: str = "smtp.gmail.com"
smtp_port: int = 587
smtp_user: str = ""
smtp_pass: str = ""
smtp_from: str = "prenotazioni@farmaciaianni.it"
# WhatsApp gateway
wa_gateway_url: str = "http://host.docker.internal:18800/api/wa/send"
wa_enabled: bool = True
# Timezone
timezone: str = "Europe/Rome"
model_config = {"env_prefix": "BOOKING_", "env_file": ".env", "extra": "ignore"}
@property
def allowed_domains_list(self) -> list[str]:
return [d.strip() for d in self.allowed_domains.split(",") if d.strip()]
@lru_cache()
def get_settings() -> Settings:
return Settings()