150 lines
6.9 KiB
Python
150 lines
6.9 KiB
Python
import os
|
|
from pathlib import Path
|
|
from typing import Any
|
|
from pydantic_settings import BaseSettings
|
|
|
|
class Settings(BaseSettings):
|
|
RUNTIME_ENV: str = "development"
|
|
ENVIRONMENT: str = "development"
|
|
# Simulation/swarm safety switches. Both default off and must be explicitly
|
|
# enabled by the isolated simulation launcher (Backend/.env.sim).
|
|
SIMULATION_MODE: bool = False
|
|
PAYMENT_SIMULATOR_ENABLED: bool = False
|
|
SIM_CUSTOMER_EMAIL_DOMAIN: str = "@sim.example.com"
|
|
DATABASE_URL: str = "mysql+pymysql://Adithiyan:Adithiyan$2025Mysql@127.0.0.1:3306/ifixkartecommerceadmin"
|
|
CORE_DATABASE_URL: str = "mysql+pymysql://Adithiyan:Adithiyan$2025Mysql@127.0.0.1:3306/ifixkartecommerceadmin"
|
|
CRM_DATABASE_URL: str = "mysql+pymysql://Adithiyan:Adithiyan$2025Mysql@127.0.0.1:3306/ifixkartcrm"
|
|
COMMERCE_DATABASE_URL: str = "mysql+pymysql://Adithiyan:Adithiyan$2025Mysql@127.0.0.1:3306/ifixkartecommerce"
|
|
JWT_PRIVATE_KEY_PATH: str = "jwt_private.pem"
|
|
JWT_PUBLIC_KEY_PATH: str = "jwt_public.pem"
|
|
ALGORITHM: str = "RS512"
|
|
ACCESS_TOKEN_EXPIRE_MIN: int = 30
|
|
REFRESH_TOKEN_EXPIRE_DAYS: int = 30
|
|
PROJECT_NAME: str = "iFixKart"
|
|
MAX_FAILED_LOGIN: int = 5
|
|
LOCKOUT_MINUTES: int = 15
|
|
SECRET_KEY: str
|
|
PUBLIC_API_KEY: str
|
|
GOOGLE_CLIENT_ID: str = ""
|
|
GOOGLE_CLIENT_SECRET: str = ""
|
|
GOOGLE_REDIRECT_URI: str = ""
|
|
RAZORPAY_KEY_ID: str = "rzp_test_TTUzPFYF0hRV89"
|
|
RAZORPAY_KEY_SECRET: str = "74tmlSkS4qK7zQaH1zclQfeH"
|
|
RAZORPAY_WEBHOOK_SECRET: str = "6TjjXgErPG3@ZpM"
|
|
RAZORPAY_ENABLED: bool = True
|
|
|
|
# ZeptoMail / Zoho CPaaS Configuration
|
|
ZEPTOMAIL_HOST: str = "smtp.zeptomail.in"
|
|
ZEPTOMAIL_API_ENDPOINT: str = "https://cpaas.zoho.in/v1.1/email"
|
|
ZEPTOMAIL_API_KEY: str = "PHtE6r0PQujsjDQnoBYH4aLsH8H3Z458+rtjKwcVuYcQWfVVF00G+d5+xzTl/UsqB/QTFPXPmolptuzP5bqHLW7pMWwfCGqyqK3sx/VYSPOZsbq6x00Zsl8dcEzdV4TtddNq0CDfv97TNA=="
|
|
EMAIL_SENDER_ADDRESS: str = "info@trionixsolution.com"
|
|
|
|
# Self-Hosted OpenWA WhatsApp Gateway Configuration
|
|
OPENWA_GATEWAY_URL: str = "http://localhost:8088"
|
|
OPENWA_MASTER_KEY: str = "owa_k1_df65037ea78c5ca9f19c63a6fb591e1d766581705c1dde392f098f6364387948"
|
|
|
|
# Redis Streams Event Bus Configuration
|
|
REDIS_URL: str = "redis://127.0.0.1:6379/0"
|
|
|
|
# ==========================================
|
|
# Google Analytics 4 (GA4) [Active Testing from Sassynest]
|
|
# ==========================================
|
|
GA4_ENABLED: bool = True
|
|
GA4_PROPERTY_ID: str = "521198579"
|
|
GA4_CREDENTIALS_JSON_PATH: str = "credentials/google-analytics-service-account.json"
|
|
|
|
# ==========================================
|
|
# Google Merchant Center Configuration
|
|
# ==========================================
|
|
MERCHANT_CENTER_STORE_NAME: str = "iFixKart"
|
|
MERCHANT_CENTER_STORE_URL: str = "https://ifixkart.trionixsolution.com"
|
|
MERCHANT_CENTER_DEFAULT_CURRENCY: str = "INR"
|
|
|
|
# ==========================================
|
|
# Meta Social Media (Instagram & Facebook Graph API v22.0)
|
|
# ==========================================
|
|
META_ENABLED: bool = True
|
|
META_GRAPH_API_BASE: str = "https://graph.facebook.com/v22.0"
|
|
META_APP_ID: str = "1208251298791396"
|
|
META_APP_SECRET: str = "01a1cd941e5899e8d05b94562355445c"
|
|
META_ACCESS_TOKEN: str = "EAAScmK9ZBXQBOQRCMNGua2c10swsJ3s5ZA5E4autreZArdRwzpHuWK8Inx4iAZC6Bo5LFdi1XCzckjNHOY7TbqvZBNJEbmEm4FEDygeIXHwZCxfdIHFZArZAZt5tdtemAZCA3sn46Vh1ZBwYnbjjUVfpRDjS1TNmj341DqE9EQ4sNjyEq63ZATd6cgXqr5ZAZAmt6U5KIGGIpypDqP8oH"
|
|
META_PAGE_ACCESS_TOKEN: str = "EAAScmK9ZBXQBQREbPyJyKsLDhzPB8NeBGmsjqUJSffhiLvmowzBqIdHbpNmPmuD6M0GsRscYC1EZ8ZAz7qQNeU7EkGtaEuarz8RIDZBwcvCqBSz24sKSJcCtmgP2H75sDhgkpfi28AZCIc6miBqUFqEUFs1xpMh1x5Qpf0uY4w460LyqMaEtXImIq2pJZA8qtTdOBIP7EzcIVzbZCzJ0HfvK0"
|
|
FACEBOOK_PAGE_ID: str = "994740483728923"
|
|
INSTAGRAM_BUSINESS_ACCOUNT_ID: str = "17841478415652122"
|
|
META_AD_ACCOUNT_ID: str = "1307493795455160"
|
|
META_VERIFY_TOKEN: str = "meta_verify_token"
|
|
|
|
# ==========================================
|
|
# Third-Party Logistics: Shiprocket [Strictly Disabled for now]
|
|
# ==========================================
|
|
SHIPROCKET_ENABLED: bool = False
|
|
SHIPROCKET_EMAIL: str = ""
|
|
SHIPROCKET_PASSWORD: str = ""
|
|
SHIPROCKET_PICKUP_LOCATION: str = "Primary"
|
|
SHIPROCKET_PICKUP_PIN: str = ""
|
|
SHIPROCKET_MODE: str = "test_label_only"
|
|
SHIPROCKET_API_URL: str = "https://apiv2.shiprocket.in/v1/external"
|
|
SHIPROCKET_WEBHOOK_SECRET: str = "iFixKart_Shiprocket_WH_2026"
|
|
|
|
# ==========================================
|
|
# Third-Party Logistics: Delhivery One [Trial Mode Active]
|
|
# ==========================================
|
|
DELHIVERY_ENABLED: bool = True
|
|
DELHIVERY_MODE: str = "trial" # "trial" | "live"
|
|
DELHIVERY_CLIENT_ID: str = "ucp-service-cli"
|
|
DELHIVERY_CLIENT_SECRET: str = "880A9OGX346T4ZVH7WKJHD1NISN1WL7C"
|
|
DELHIVERY_AUTH_URL: str = "https://ucp-auth.delhivery.com/holyknight"
|
|
DELHIVERY_REALM: str = "ucp-Q72U870K1D05"
|
|
DELHIVERY_CLIENT_CMS: str = "cms::client::e97e8488-2ebd-11e8-92cd-060ba07f3c3e"
|
|
DELHIVERY_MCP_URL: str = "https://mcp-client.delhivery.com/mcp"
|
|
DELHIVERY_API_TOKEN: str = ""
|
|
DELHIVERY_PICKUP_LOCATION: str = "iFixKart Central Hub"
|
|
DELHIVERY_PICKUP_PIN: str = "560001"
|
|
|
|
# ==========================================
|
|
# WhatsApp Customer Gateway (WATI) [Customer Communication]
|
|
# ==========================================
|
|
WATI_ENABLED: bool = False
|
|
WATI_API_ENDPOINT: str = "https://live-mt-server.wati.io"
|
|
WATI_API_TOKEN: str = ""
|
|
|
|
# ==========================================
|
|
# Cloud Telephony: Knowlarity SuperReceptionist
|
|
# ==========================================
|
|
KNOWLARITY_ENABLED: bool = True
|
|
KNOWLARITY_API_KEY: str = ""
|
|
KNOWLARITY_AUTHORIZATION: str = ""
|
|
KNOWLARITY_SR_NUMBER: str = ""
|
|
KNOWLARITY_CALL_URL: str = "https://kpi.knowlarity.com/Basic/v1/account/call/makecall"
|
|
KNOWLARITY_LOG_URL: str = "https://kpi.knowlarity.com/Basic/v1/account/calllog"
|
|
|
|
# ==========================================
|
|
# Security Session Inactivity Timeout
|
|
# ==========================================
|
|
SESSION_IDLE_TIMEOUT_MINUTES: int = 30
|
|
|
|
class Config:
|
|
env_file = ".env"
|
|
extra = "ignore"
|
|
|
|
settings = Settings()
|
|
|
|
def load_private_key_bytes(path=None):
|
|
p = Path(path or settings.JWT_PRIVATE_KEY_PATH)
|
|
if not p.is_absolute():
|
|
# resolve relative to project root (parent of app directory)
|
|
project_root = Path(__file__).resolve().parents[3]
|
|
p = project_root / p
|
|
if not p.exists():
|
|
raise FileNotFoundError(f"Private key not found at {p}")
|
|
return p.read_bytes()
|
|
|
|
def load_public_key_bytes(path=None):
|
|
p = Path(path or settings.JWT_PUBLIC_KEY_PATH)
|
|
if not p.is_absolute():
|
|
# resolve relative to project root (parent of app directory)
|
|
project_root = Path(__file__).resolve().parents[3]
|
|
p = project_root / p
|
|
if not p.exists():
|
|
raise FileNotFoundError(f"Public key not found at {p}")
|
|
return p.read_bytes()
|