# MCP server settings (Go)
MCP_SERVER_NAME=RagGo
MCP_SERVER_HOST=127.0.0.1
MCP_SERVER_PORT=3235
MCP_SERVER_PATH=/mcp
MCP_SERVER_TRANSPORT=http
MCP_SESSION_TIMEOUT=0
MCP_DISABLE_LOCALHOST_PROTECTION=false

# Web UI settings
# Enable the Web UI for monitoring, searching, and ingesting documents
WEB_UI_ENABLED=true
# Base path for the Web UI (default: /ui)
WEB_UI_PATH=/ui

# Python gRPC service
PYTHON_GRPC_HOST=127.0.0.1
PYTHON_GRPC_PORT=50051
# Default timeout for most gRPC operations (searches, queries, etc.)
PYTHON_GRPC_TIMEOUT=30s
# Timeout for ingestion tool responses (mostly for initial file validation)
# Note: Actual ingestion runs asynchronously in the background, so this timeout
# only applies to the initial response. Can be kept at default (5m).
PYTHON_GRPC_INGESTION_TIMEOUT=5m
# Python service management
# Auto-start Python service when Go server starts (single entry point)
PYTHON_AUTO_START=true
# Path to Python service script
PYTHON_SERVICE_PATH=python_service/raggo_service.py
# Virtual environment path
PYTHON_VENV_PATH=.venv
# Maximum automatic restarts on crash (default: 3)
PYTHON_MAX_AUTO_RESTARTS=3
# Minimum time between restart attempts (default: 10s)
PYTHON_RESTART_COOLDOWN=10s

# Licensing (client)
# License server base URL (HTTPS required)
LICENSE_SERVER_BASE_URL=https://activation.teknicae.com
# Ed25519 public key (base64) for token verification
LICENSE_PUBLIC_KEY=mGC0ZGMN7cfUayphL6EqgHyVKmP+UMxGvwi77s6aBqM=
# Offline grace period in days after last validation
LICENSE_GRACE_PERIOD_DAYS=7
# How often to attempt online validation (in hours)
LICENSE_VALIDATION_INTERVAL_HOURS=24

# Health monitoring
# The Go MCP server automatically monitors the Python service health
# Health checks run every 10 seconds with a 5-second timeout
# After 3 consecutive failures, the MCP server shuts down gracefully

# Data paths (shared)
DATA_API_GRAPH_PATH=data/API_graph/API_graph
DATA_RESOURCES_DIRECTORY=data/resources
DATA_CODE_DIRECTORY=data/code
DATA_DOCUMENTS_ENABLED=true
DATA_DOCUMENTS_DIRECTORY=data/documents

# File ingestion settings
# By default, files are automatically copied to the appropriate directory:
# - Code files (.py, .js, .go, etc.) -> data/code/
# - Document files (.pdf, .docx, .md, etc.) -> data/documents/
# To allow ingesting files from additional directories without copying,
# uncomment and set MCP_INGEST_ALLOWED_ROOTS (comma-separated paths):
# MCP_INGEST_ALLOWED_ROOTS=/path/to/extra/dir1,/path/to/extra/dir2

# Qdrant (bundled)
DATA_DOCUMENTS_QDRANT_HOST=127.0.0.1
DATA_DOCUMENTS_QDRANT_PORT=6333
DATA_DOCUMENTS_QDRANT_COLLECTION_NAME=raggo
DATA_DOCUMENTS_QDRANT_BINARY_PATH=bin/qdrant
DATA_DOCUMENTS_QDRANT_STORAGE_PATH=data/qdrant_storage
DATA_DOCUMENTS_QDRANT_SHARED=false
DATA_DOCUMENTS_EMBEDDING_MODEL=intfloat/multilingual-e5-small
DATA_DOCUMENTS_EMBEDDING_DIMENSION=384
DATA_DOCUMENTS_CHUNKING_MAX_TOKENS=1000
# Embeddings (GPU)
DATA_EMBEDDINGS_USE_GPU=false
# Optional device overrides (e.g., "cuda", "cuda:0", "cpu")
EMBEDDING_DOCS_DEVICE=
EMBEDDING_CODE_DEVICE=
# Install GPU Python deps with:
#   pip install -r python_service/requirements-gpu.txt
# Or auto-detect CUDA and install:
#   ./scripts/install-python-deps.sh
#   powershell -ExecutionPolicy Bypass -File scripts/install-python-deps.ps1
QDRANT_UPSERT_BATCH_SIZE=64
QDRANT_MAX_PAYLOAD_BYTES=31000000

# Backup & Restore
# Timeout for backup/restore gRPC operations (default: 30m — large datasets may need more)
PYTHON_GRPC_BACKUP_TIMEOUT=30m
# Default directory for backups
BACKUP_DEFAULT_DIR=data/backups

# OCR
DATA_DOCUMENTS_OCR_ENABLED=true
DATA_DOCUMENTS_OCR_FORCE=false
DATA_DOCUMENTS_OCR_LANGUAGES=eng
DATA_DOCUMENTS_OCR_USE_GPU=false

# Search defaults
DATA_DOCUMENTS_SEARCH_DEFAULT_TOP_K=5
DATA_DOCUMENTS_SEARCH_DEFAULT_THRESHOLD=0.4
TOOLS_DEFAULT_TOP_K=5
TOOLS_MAX_CLASS_MEMBERS=20
TOOLS_MAX_FUNCTION_MATCHES=5

# Performance
PERFORMANCE_REINDEX_TIMEOUT=300
PERFORMANCE_CONCURRENT_REQUESTS=true

# Logging
LOGGING_LOG_DIRECTORY=logs
LOGGING_REQUEST_DB=logs/mcp_requests.db
LOGGING_SERVER_LOG=logs/server.log

# Log levels: DEBUG, INFO, WARNING, ERROR, CRITICAL
SERVER_LOG_LEVEL=INFO

# Log rotation settings
# Maximum size of each log file before rotation (in MB)
LOG_MAX_SIZE_MB=10
# Number of rotated backup log files to keep
LOG_BACKUP_COUNT=5

# Ingestion limits
# Maximum number of concurrent ingestion threads (default: 4)
MAX_CONCURRENT_INGESTIONS=4
# Maximum file size for ingestion in MB (default: 500)
MAX_INGESTION_FILE_SIZE_MB=500
# Qdrant startup timeout in seconds (default: 30)
QDRANT_STARTUP_TIMEOUT=30
