# =============================================================================
# 宝塔部署模板 — 192.168.2.14 + MySQL(chajia)
# 首次部署：cp deploy/.env.bt-host-mysql.example .env  再 bash deploy/install-bt-host-mysql.sh
# 更新代码：勿覆盖服务器已有 .env（上传包不含根目录 .env）
# =============================================================================

APP_PORT=30325
PUBLIC_HOST=192.168.2.14

MYSQL_USER=chajia
MYSQL_PASSWORD=7WGSADmDRTh6firE
MYSQL_HOST=host.docker.internal
MYSQL_PORT=3306
MYSQL_DATABASE=chajia

DATABASE_URL=mysql://chajia:7WGSADmDRTh6firE@host.docker.internal:3306/chajia

JWT_SECRET=K8mNx2pQ9vL4wR7yT1zA6bC0dE5fH3jG

HOST_SERVICE_TOKENS={"chajia-neibu-2026":{"customerId":"CUST_001","permissions":["pricing:markup:write"]},"demo-host-token":{"customerId":"CUST_001","permissions":["pricing:markup:write"]}}
CUSTOMER_REGISTRY=CUST_001

# 美美与共等宿主：两步公开接口（免 Token）；上线前建议改 false 并配 Token
HOST_PUBLIC_API_ENABLED=true
HOST_PUBLIC_DEFAULT_CUSTOMER_ID=CUST_001

# embed-demo 构建时写入前端（须为 HOST_SERVICE_TOKENS 中的 key）
NEXT_PUBLIC_EMBED_DEMO_SERVICE_TOKEN=chajia-neibu-2026
NEXT_PUBLIC_EMBED_DEMO_CUSTOMER_ID=CUST_001

MOTHERSHIP_QUOTE_URLS=https://www.mothership.com/
RPA_MOCK_MODE=false
RPA_ADDRESS_MODE=real
RPA_QUOTE_MODE=direct
# API 侧 direct 成功时直接返回 done；失败再回退 BullMQ
RPA_INLINE_DIRECT_QUOTE=true
# 生产环境关闭 Widget 浏览器填表回退（直连失败时快速报错，避免卡 6~12 分钟）
RPA_DISABLE_WIDGET_QUOTE_FALLBACK=true
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_EMAIL=
MOTHERSHIP_PASSWORD=

# 地址候选仅对前 K 条做 fetchPlace 校验（其余默认可选，加快联想）
AXEL_CANDIDATE_VERIFY_TOP_K=3
# 宿主 submit 服务端轮询间隔（毫秒）；embed 前端仍为 2s
HOST_QUOTE_POLL_INTERVAL_MS=500

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

# Priority1 RPA 生产提速（worker 填表）
RPA_DWELL_MS=0
RPA_SLOW_MO_MS=0
RPA_QUOTE_POLL_MS=600
RPA_QUOTE_WAIT_MS=90000
RPA_PRIORITY1_WORKER_FAST=true

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'

# REDIS_URL 由 docker-compose.bt-host-mysql.yml 自动注入 redis://redis:6379
