# =============================================================================
# 查价中台 — 生产环境配置模板
# 使用：复制到项目根目录并重命名为 .env
#   cp deploy/.env.production.example .env
# 将下方所有「请填写」项改为真实值后执行：bash deploy/install.sh
# =============================================================================

# ── 必填：安全与租户 ──────────────────────────────────────────────────────────

# 【请填写】MySQL root 密码（强密码，勿使用 changeme）
MYSQL_ROOT_PASSWORD=CHANGE_ME_STRONG_PASSWORD

# 【请填写】管理端 JWT 密钥（随机 32+ 字符，例：openssl rand -base64 32）
JWT_SECRET=CHANGE_ME_RANDOM_JWT_SECRET

# 【请填写】对外 API 域名（仅文档/自检用，不含 https://）
PUBLIC_DOMAIN=quote.example.com

# 【请填写】给外部系统调用的 Service Token（JSON 单行，勿换行）
# 格式：{"你的token字符串":{"customerId":"CUST_001","permissions":["pricing:markup:write"]}}
# 外部系统请求头：Authorization: Bearer <token> ；X-Customer-Id: CUST_001
HOST_SERVICE_TOKENS={"CHANGE_ME_EXTERNAL_API_TOKEN":{"customerId":"CUST_001","permissions":["pricing:markup:write"]}}

# 【请填写】客户 ID 列表（逗号分隔，须与 HOST_SERVICE_TOKENS 中 customerId 一致）
CUSTOMER_REGISTRY=CUST_001

# ── 应用端口（一般无需改）──────────────────────────────────────────────────────

# 仅绑定 127.0.0.1，由 Nginx 反代；勿直接暴露公网
APP_PORT=3000

# ── RPA / Mothership（生产必填）──────────────────────────────────────────────

MOTHERSHIP_QUOTE_URLS=https://www.mothership.com/
RPA_MOCK_MODE=false
RPA_ADDRESS_MODE=real
RPA_QUOTE_MODE=direct
RPA_HEADLESS=true
RPA_BROWSER_LOCALE=en-US
RPA_USE_PATCHRIGHT=false
RPA_USE_STEALTH=false
RPA_QUEUE_ENABLED=true
RPA_PARKED_SESSION=false
RPA_STORAGE_STATE_PATH=.rpa/mothership-storage.json
RPA_AUTO_BOOTSTRAP_STORAGE=true
RPA_PLACE_FIX_MODE=event
RPA_PLACE_DIAG=false

# 【若 Mothership 跳转登录页则必填】否则可留空
MOTHERSHIP_EMAIL=
MOTHERSHIP_PASSWORD=

MOTHERSHIP_QUOTE_API_URL_PATTERNS=services.mothership.com/axel/quote
RPA_QUOTE_NETWORK_VISIBILITY=false
RPA_QUOTE_DEBUG_RAW=false
RPA_QUOTE_NETWORK_SNIFF=false

# Selector（与开发环境默认一致；Mothership 改版时再更新）
RPA_SELECTOR_PICKUP_SECTION=#react-quoter-landing-plugin >> text=Pick up from,#react-quoter-landing-plugin >> text=Where to pick up,#react-quoter-landing-plugin >> text=从何处取货
RPA_SELECTOR_DELIVERY_SECTION=#react-quoter-landing-plugin >> text=Deliver to,#react-quoter-landing-plugin >> text=Delivery to,#react-quoter-landing-plugin >> text=送货至
RPA_SELECTOR_QUOTE_WIDGET=#react-quoter-landing-plugin
RPA_SELECTOR_PICKUP_STREET=#react-quoter-landing-plugin >> placeholder=Search by address,#react-quoter-landing-plugin >> role=textbox[name="Search by address"],#react-quoter-landing-plugin >> role=textbox[name="Search address"],#react-quoter-landing-plugin >> role=textbox[name="搜索地址"]
RPA_SELECTOR_DELIVERY_STREET=#react-quoter-landing-plugin >> placeholder=Search by address,#react-quoter-landing-plugin >> role=textbox[name="Search by address"],#react-quoter-landing-plugin >> role=textbox[name="Search address"],#react-quoter-landing-plugin >> role=textbox[name="搜索地址"]
RPA_SELECTOR_ADDRESS_SUGGESTION=#react-quoter-landing-plugin >> [role="listbox"] [role="option"],#react-quoter-landing-plugin >> li,.pac-item,[role="option"]
RPA_SELECTOR_CARGO_SECTION=#react-quoter-landing-plugin >> filter:text=Shipment details>>nth=4,#react-quoter-landing-plugin >> filter:text=Freight details>>nth=4,#react-quoter-landing-plugin >> filter:text=货运详情>>nth=4
RPA_SELECTOR_SUBMIT=role=button[name="GET QUOTE"],role=button[name="Get freight quote"],role=button[name="Get a freight quote"],role=button[name="获取货运报价"]
RPA_SELECTOR_TRANSIT=text=business days

# ── 以下由 docker-compose 自动注入，勿改（install.sh 会校验）────────────────────

# DATABASE_URL=mysql://root:...@mysql:3306/chajia
# REDIS_URL=redis://redis:6379
