-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy path.env.example
More file actions
190 lines (155 loc) · 6.65 KB
/
Copy path.env.example
File metadata and controls
190 lines (155 loc) · 6.65 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
# =============================================================================
# Litecoin Knowledge Hub - Environment Variables Template
# =============================================================================
# Copy this file to create your environment-specific configuration:
# - .env.local (local development with localhost URLs)
# - .env.docker.dev (Docker development with service names)
# - .env.docker.prod (Docker production with production URLs)
# - .env.prod-local (local production build verification)
#
# See docs/setup/ENVIRONMENT_VARIABLES.md for full documentation.
# =============================================================================
# =============================================================================
# 1. SERVICE URLs
# =============================================================================
# Adjust these based on your environment (localhost vs Docker service names)
# Backend API URL (internal)
BACKEND_URL=http://localhost:8000
# Payload CMS public URL
PAYLOAD_PUBLIC_SERVER_URL=http://localhost:3001
# RAG markdown source links [title](url): defaults to PAYLOAD_PUBLIC_SERVER_URL + /articles/{slug}
# ARTICLE_PUBLIC_BASE_URL=https://cms.lite.space
# ARTICLE_PUBLIC_PATH_TEMPLATE=/articles/{slug}
# Frontend URL (for CORS/CSRF)
FRONTEND_URL=http://localhost:3000
# URLs exposed to browser (used by frontend and admin frontend)
NEXT_PUBLIC_BACKEND_URL=http://localhost:8000
NEXT_PUBLIC_PAYLOAD_URL=http://localhost:3001
# Admin frontend URL (automatically added to CORS origins)
ADMIN_FRONTEND_URL=http://localhost:3003
# =============================================================================
# 2. DATABASE CONNECTIONS
# =============================================================================
# For local MongoDB (Docker container):
# MONGO_URI=mongodb://localhost:27017
# For cloud MongoDB (Atlas):
# MONGO_URI=mongodb+srv://user:password@cluster.mongodb.net/litecoin_rag_db
MONGO_URI=mongodb://localhost:27017
MONGO_DETAILS=mongodb://localhost:27017
DATABASE_URI=mongodb://localhost:27017/payload_cms
REDIS_URL=redis://localhost:6379/0
# =============================================================================
# 3. SECRETS (set in service-specific .env files, not here)
# =============================================================================
# These are documented here but should be set in:
# - backend/.env: GOOGLE_API_KEY, WEBHOOK_SECRET, ADMIN_TOKEN
# - payload_cms/.env: PAYLOAD_SECRET, WEBHOOK_SECRET
#
# GOOGLE_API_KEY=your-google-api-key
# PAYLOAD_SECRET=your-payload-secret
# WEBHOOK_SECRET=your-webhook-secret
# ADMIN_TOKEN=your-admin-token
# =============================================================================
# 4. CONFIGURATION
# =============================================================================
# Database names
MONGO_DB_NAME=litecoin_rag_db
MONGO_COLLECTION_NAME=litecoin_docs
# Embedding model (default: local sentence-transformers)
EMBEDDING_MODEL=sentence-transformers/all-mpnet-base-v2
# CORS origins (comma-separated)
CORS_ORIGINS=http://localhost:3000,https://chat.lite.space
# Rate limiting
RATE_LIMIT_PER_MINUTE=20
RATE_LIMIT_PER_HOUR=300
# Payload CMS URL for suggested questions
PAYLOAD_URL=http://localhost:3001
SUGGESTED_QUESTION_CACHE_TTL=86400
# Payload CMS API key (required for Knowledge Gap Flywheel -> CMS draft publishing)
# PAYLOAD_API_KEY=
# Knowledge Gap Flywheel
USE_SEARCH_GROUNDING=true
USE_KNOWLEDGE_GAP_DETECTION=true
SEARCH_GROUNDING_SOURCE_THRESHOLD=2
# Activate grounding if best cross-encoder score is below this (ms-marco logit scale)
SEARCH_GROUNDING_RELEVANCE_THRESHOLD=3.0
# Logging
LOG_LEVEL=INFO
JSON_LOGGING=false
# LLM spend limits
DAILY_SPEND_LIMIT_USD=5.00
HOURLY_SPEND_LIMIT_USD=1.00
# Challenge-response fingerprinting
CHALLENGE_TTL_SECONDS=300
CHALLENGE_RATE_LIMIT_PER_MINUTE=10
CHALLENGE_RATE_LIMIT_PER_HOUR=100
MAX_ACTIVE_CHALLENGES_PER_IDENTIFIER=3
ENABLE_CHALLENGE_RESPONSE=true
# Global rate limiting
GLOBAL_RATE_LIMIT_PER_MINUTE=1000
GLOBAL_RATE_LIMIT_PER_HOUR=50000
ENABLE_GLOBAL_RATE_LIMIT=true
# Cloudflare Turnstile (optional)
ENABLE_TURNSTILE=false
# TURNSTILE_SECRET_KEY=your-turnstile-secret
# Cost throttling
HIGH_COST_THRESHOLD_USD=10.0
HIGH_COST_WINDOW_SECONDS=600
ENABLE_COST_THROTTLING=true
COST_THROTTLE_DURATION_SECONDS=30
# Security
TRUST_X_FORWARDED_FOR=false
# =============================================================================
# 5. MONITORING (optional)
# =============================================================================
GRAFANA_ADMIN_USER=admin
# GRAFANA_ADMIN_PASSWORD must be set (no default)
GRAFANA_ADMIN_PASSWORD=
# =============================================================================
# 6. DOCKER-SPECIFIC
# =============================================================================
WATCHPACK_POLLING=true
HOSTNAME=0.0.0.0
# =============================================================================
# 7. LOCAL RAG - High-Performance Local Processing with Cloud Spillover
# =============================================================================
# Enable local-first RAG processing using Ollama (query rewriting), Infinity
# (embeddings), and Redis Stack (vector cache) with automatic cloud fallback.
#
# To enable, start Docker with the local-rag profile:
# docker-compose -f docker-compose.prod.yml --profile local-rag up
#
# Then set these feature flags to true:
# USE_LOCAL_REWRITER=true
# USE_INFINITY_EMBEDDINGS=true
# USE_REDIS_CACHE=true
#
# See docs/features/DEC6_FEATURE_HIGH_PERFORMANCE_LOCAL_RAG.md for details.
# =============================================================================
# --- Feature Flags ---
# Set to 'true' to enable local RAG processing (default: false, uses cloud)
USE_LOCAL_REWRITER=true
USE_INFINITY_EMBEDDINGS=true
USE_REDIS_CACHE=true
# --- Service URLs ---
# Docker internal URLs (use localhost:PORT when running scripts from host)
OLLAMA_URL=http://ollama:11434
INFINITY_URL=http://host.docker.internal:7997
REDIS_STACK_URL=redis://redis_stack:6379
# --- Router Configuration ---
# Maximum concurrent requests to local rewriter before spillover to Gemini
MAX_LOCAL_QUEUE_DEPTH=3
# Timeout for local rewriter before failing over to Gemini (seconds)
LOCAL_TIMEOUT_SECONDS=2.0
# --- Model Configuration ---
# Ollama model for query rewriting
LOCAL_REWRITER_MODEL=llama3.2:3b
# Infinity embedding model (1024-dim vectors)
EMBEDDING_MODEL_ID=dunzhang/stella_en_1.5B_v5
# Vector dimension (must match embedding model)
VECTOR_DIMENSION=1024
# --- Redis Stack Vector Cache ---
# Index name for vector cache
REDIS_CACHE_INDEX_NAME=cache:index
# Similarity threshold for cache hits (0.90 = 90% similarity required)
REDIS_CACHE_SIMILARITY_THRESHOLD=0.90