[2ff88f42] Finalize SuperOffice Connector: Centralized Config, Added Position/Role Mapping Logic, and Discovery Tools
This commit is contained in:
@@ -1,45 +1,44 @@
|
||||
import os
|
||||
from dotenv import load_dotenv
|
||||
from pydantic_settings import BaseSettings
|
||||
|
||||
# Load environment variables
|
||||
if os.path.exists(".env"):
|
||||
load_dotenv(".env", override=True)
|
||||
elif os.path.exists("../.env"):
|
||||
load_dotenv("../.env", override=True)
|
||||
|
||||
class Config:
|
||||
# SuperOffice API Configuration
|
||||
SO_CLIENT_ID = os.getenv("SO_SOD")
|
||||
SO_CLIENT_SECRET = os.getenv("SO_CLIENT_SECRET")
|
||||
SO_CONTEXT_IDENTIFIER = os.getenv("SO_CONTEXT_IDENTIFIER")
|
||||
SO_REFRESH_TOKEN = os.getenv("SO_REFRESH_TOKEN")
|
||||
class Settings(BaseSettings):
|
||||
# --- Infrastructure ---
|
||||
# Internal Docker URL for Company Explorer
|
||||
COMPANY_EXPLORER_URL: str = "http://company-explorer:8000"
|
||||
|
||||
# Company Explorer Configuration
|
||||
CE_API_URL = os.getenv("CE_API_URL", "http://company-explorer:8000")
|
||||
CE_API_USER = os.getenv("CE_API_USER", "admin")
|
||||
CE_API_PASSWORD = os.getenv("CE_API_PASSWORD", "gemini")
|
||||
# --- SuperOffice API Credentials ---
|
||||
SO_ENVIRONMENT: str = "sod" # 'sod' or 'online'
|
||||
SO_CLIENT_ID: str = ""
|
||||
SO_CLIENT_SECRET: str = ""
|
||||
SO_REFRESH_TOKEN: str = ""
|
||||
SO_REDIRECT_URI: str = "http://localhost"
|
||||
SO_CONTEXT_IDENTIFIER: str = "Cust55774" # e.g. Cust12345
|
||||
|
||||
# --- Feature Flags ---
|
||||
ENABLE_WEBSITE_SYNC: bool = False # Disabled by default to prevent loops
|
||||
|
||||
# --- Mappings (IDs from SuperOffice) ---
|
||||
# Vertical IDs (List Items)
|
||||
# Default values match the current hardcoded DEV IDs
|
||||
# Format: "Name In Explorer": ID_In_SuperOffice
|
||||
VERTICAL_MAP_JSON: str = '{"Logistics - Warehouse": 23, "Healthcare - Hospital": 24, "Infrastructure - Transport": 25, "Leisure - Indoor Active": 26}'
|
||||
|
||||
# UDF Mapping (ProgIds) - Defaulting to SOD values, should be overridden in Prod
|
||||
UDF_CONTACT_MAPPING = {
|
||||
"ai_challenge_sentence": os.getenv("UDF_CONTACT_CHALLENGE", "SuperOffice:1"),
|
||||
"ai_sentence_timestamp": os.getenv("UDF_CONTACT_TIMESTAMP", "SuperOffice:2"),
|
||||
"ai_sentence_source_hash": os.getenv("UDF_CONTACT_HASH", "SuperOffice:3"),
|
||||
"ai_last_outreach_date": os.getenv("UDF_CONTACT_OUTREACH", "SuperOffice:4")
|
||||
}
|
||||
# Persona / Job Role IDs (List Items for "Position" field)
|
||||
# To be filled after discovery
|
||||
PERSONA_MAP_JSON: str = '{}'
|
||||
|
||||
UDF_PERSON_MAPPING = {
|
||||
"ai_email_draft": os.getenv("UDF_PERSON_DRAFT", "SuperOffice:1"),
|
||||
"ma_status": os.getenv("UDF_PERSON_STATUS", "SuperOffice:2")
|
||||
}
|
||||
# User Defined Fields (ProgIDs)
|
||||
# The technical names of the fields in SuperOffice
|
||||
# Default values match the current hardcoded DEV UDFs
|
||||
UDF_SUBJECT: str = "SuperOffice:5"
|
||||
UDF_INTRO: str = "SuperOffice:6"
|
||||
UDF_SOCIAL_PROOF: str = "SuperOffice:7"
|
||||
UDF_VERTICAL: str = "SuperOffice:5" # NOTE: Currently same as Subject in dev? Need to verify. worker.py had 'SuperOffice:5' for vertical AND 'SuperOffice:5' for subject in the map?
|
||||
|
||||
class Config:
|
||||
env_file = ".env"
|
||||
env_file_encoding = "utf-8"
|
||||
extra = "ignore" # Ignore extra fields in .env
|
||||
|
||||
# MA Status ID Mapping (Text -> ID) - Defaulting to discovered SOD values
|
||||
MA_STATUS_ID_MAP = {
|
||||
"Ready_to_Send": int(os.getenv("MA_STATUS_ID_READY", 11)),
|
||||
"Sent_Week1": int(os.getenv("MA_STATUS_ID_WEEK1", 12)),
|
||||
"Sent_Week2": int(os.getenv("MA_STATUS_ID_WEEK2", 13)),
|
||||
"Bounced": int(os.getenv("MA_STATUS_ID_BOUNCED", 14)),
|
||||
"Soft_Denied": int(os.getenv("MA_STATUS_ID_DENIED", 15)),
|
||||
"Interested": int(os.getenv("MA_STATUS_ID_INTERESTED", 16)),
|
||||
"Out_of_Office": int(os.getenv("MA_STATUS_ID_OOO", 17)),
|
||||
"Unsubscribed": int(os.getenv("MA_STATUS_ID_UNSUB", 18))
|
||||
}
|
||||
# Global instance
|
||||
settings = Settings()
|
||||
|
||||
Reference in New Issue
Block a user