Files
Brancheneinstufung2/connector-superoffice/config.py

53 lines
3.3 KiB
Python

import os
from dotenv import load_dotenv
# Explicitly load .env from the project root.
# CRITICAL: override=True ensures we read from the .env file even if
# stale env vars are present in the shell process.
dotenv_path = os.path.abspath(os.path.join(os.path.dirname(__file__), '..', '.env'))
if os.path.exists(dotenv_path):
load_dotenv(dotenv_path=dotenv_path, override=True)
class Settings:
def __init__(self):
# --- Infrastructure ---
# Internal Docker URL for Company Explorer
self.COMPANY_EXPLORER_URL = os.getenv("COMPANY_EXPLORER_URL", "http://company-explorer:8000")
# --- SuperOffice API Credentials ---
# Fallback for empty string in env var
env_val = os.getenv("SO_ENVIRONMENT")
self.SO_ENVIRONMENT = env_val if env_val else "online3"
self.SO_CLIENT_ID = os.getenv("SO_CLIENT_ID", "")
self.SO_CLIENT_SECRET = os.getenv("SO_CLIENT_SECRET", "")
self.SO_REFRESH_TOKEN = os.getenv("SO_REFRESH_TOKEN", "")
self.SO_REDIRECT_URI = os.getenv("SO_REDIRECT_URI", "http://localhost")
self.SO_CONTEXT_IDENTIFIER = os.getenv("SO_CONTEXT_IDENTIFIER", "Cust55774") # e.g. Cust12345
# --- Feature Flags ---
self.ENABLE_WEBSITE_SYNC = os.getenv("ENABLE_WEBSITE_SYNC", "False").lower() in ("true", "1", "t")
# Mappings (IDs from SuperOffice)
# Vertical IDs (List Items)
self.VERTICAL_MAP_JSON = os.getenv("VERTICAL_MAP_JSON", '{"Automotive - Dealer": 1613, "Corporate - Campus": 1614, "Energy - Grid & Utilities": 1615, "Energy - Solar/Wind": 1616, "Healthcare - Care Home": 1617, "Healthcare - Hospital": 1618, "Hospitality - Gastronomy": 1619, "Hospitality - Hotel": 1620, "Industry - Manufacturing": 1621, "Infrastructure - Communities": 1622, "Infrastructure - Public": 1623, "Infrastructure - Transport": 1624, "Infrastructure - Parking": 1625, "Leisure - Entertainment": 1626, "Leisure - Fitness": 1627, "Leisure - Indoor Active": 1628, "Leisure - Outdoor Park": 1629, "Leisure - Wet & Spa": 1630, "Logistics - Warehouse": 1631, "Others": 1632, "Reinigungsdienstleister": 1633, "Retail - Food": 1634, "Retail - Non-Food": 1635, "Retail - Shopping Center": 1636, "Tech - Data Center": 1637}')
# Persona / Job Role IDs (List Items for "Position" field)
self.PERSONA_MAP_JSON = os.getenv("PERSONA_MAP_JSON", '{}')
# User Defined Fields (ProgIDs)
self.UDF_SUBJECT = os.getenv("UDF_SUBJECT", "SuperOffice:5")
self.UDF_INTRO = os.getenv("UDF_INTRO", "SuperOffice:6")
self.UDF_SOCIAL_PROOF = os.getenv("UDF_SOCIAL_PROOF", "SuperOffice:7")
self.UDF_VERTICAL = os.getenv("UDF_VERTICAL", "SuperOffice:5")
self.UDF_OPENER = os.getenv("UDF_OPENER", "SuperOffice:6")
self.UDF_OPENER_SECONDARY = os.getenv("UDF_OPENER_SECONDARY", "SuperOffice:7")
self.UDF_CAMPAIGN = os.getenv("UDF_CAMPAIGN", "SuperOffice:23") # Default from discovery
self.UDF_UNSUBSCRIBE_LINK = os.getenv("UDF_UNSUBSCRIBE_LINK", "SuperOffice:22")
self.UDF_SUMMARY = os.getenv("UDF_SUMMARY", "SuperOffice:84")
self.UDF_LAST_UPDATE = os.getenv("UDF_LAST_UPDATE", "SuperOffice:85")
self.UDF_LAST_OUTREACH = os.getenv("UDF_LAST_OUTREACH", "SuperOffice:88")
# Global instance
settings = Settings()