# openJiuwen DeepSearch Configuration
# This file contains the essential environment variables
# Copy this file to .env and modify the values according to your environment

# =============================================================================
# BACKEND CONFIGURATION
# =============================================================================

# Backend service port
BACKEND_PORT=6000

# Host binding (0.0.0.0 for all interfaces)
HOST=0.0.0.0

# Worker num
WORKER_NUM=1

# Optional develop or product.
# In product mode, the environment variable SERVER_AES_MASTER_KEY_ENV must be set to ensure that sensitive information not persisted to disk
SERVICE_MODE=develop

# llm ssl verify
LLM_SSL_VERIFY=False
LLM_SSL_CERT=
# tool ssl verify
TOOL_SSL_VERIFY=False
TOOL_SSL_CERT=

# Runtime API URL safety guard. Keep false by default.
# Set true only for local debugging with private/local endpoints (e.g. 127.0.0.1).
RUNTIME_API_ALLOW_UNSAFE_URL=false

# embedding ssl verify (used for knowledge base index building)
EMBEDDING_SSL_VERIFY=False
EMBEDDING_SSL_CERT=
# Embedding service URL SSRF guard (same semantics as RUNTIME_API_ALLOW_UNSAFE_URL).
EMBEDDING_SERVICE_ALLOW_UNSAFE_URL=false

# api_key encrypt key, only takes effect when SERVICE_MODE is set to develop.
# require 32-byte (256-bit) AES key
SERVER_AES_MASTER_KEY=

# =============================================================================
# DB/STORE CONFIGURATION
# =============================================================================
# Database type (mysql/sqlite)
# 若 CHECKPOINTER_TYPE=redis(多实例分布式),必须为 mysql,且各实例共用同一 MySQL。
DB_TYPE=sqlite

# MySQL database configuration
DB_HOST=localhost
DB_PORT=3306
DB_USER=root
DB_PASSWORD=root
DEEPSEARCH_DB_NAME=openjiuwen_deepsearch

# SQLite configuration (used when DB_TYPE=sqlite)
SQLITE_DB_PATH=data/databases
DEEPSEARCH_SQLITE_DB=agent.db

# Knowledge base configuration
INDEX_MANAGER_TYPE=milvus
MILVUS_HOST=localhost
MILVUS_PORT=19530
# Milvus 认证 token,无认证时留空;run 接口要求 token 为字符串,未配置会报错
MILVUS_TOKEN=

# Huawei Cloud KMS 加解密模式(用于解密敏感配置)
HUAWEICLOUD_KMS_ENABLED=false

# Checkpointer Configuration
# 可选项:in_memory(基于内存)/ persistence(基于sqllite) / redis(支持分布式部署,须 DB_TYPE=mysql 共用库))
CHECKPOINTER_TYPE=in_memory

# 仅CHECKPOINTER_TYPE=persistence时需要配置
# 可选项 sqlite/shelve
CHECKPOINTER_DB_TYPE=sqlite
CHECKPOINTER_DB_PATH=data/databases/checkpointer.db

# 仅CHECKPOINTER_TYPE=redis时需要配置
REDIS_URL=redis://redis-host:6379
# 是否是redis cluster
REDIS_CLUSTER_MODE=false
# redis会话状态过期时间
REDIS_TTL=7200
# 每次读取是否延长TTL
REDIS_REFRESH_ON_READ=true
# 分布式(CHECKPOINTER_TYPE=redis)时知识库文档必须写入 OBS,需同时完整配置下方 OBS_*,否则服务无法启动
# in_memory / persistence 时知识库仅服务端本地存储,无需配置 OBS

# OBS config
OBS_ACCESS_KEY_ID=
OBS_SECRET_ACCESS_KEY=
OBS_SERVER=
OBS_REGION=
OBS_BUCKET=