Repository navigation
Expand file tree
/
Copy path.env.example
More file actions
141 lines (122 loc) · 4.9 KB
/
Copy path.env.example
File metadata and controls
141 lines (122 loc) · 4.9 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
# LocalChat Environment Configuration
# Copy this file to .env and fill in your actual values
# ============================================================================
# APPLICATION SETTINGS
# ============================================================================
APP_NAME=LocalChat
APP_ENV=development # development, staging, production
DEBUG=True
SECRET_KEY=change-this-to-a-random-secret-key-in-production
# Server Configuration
HOST=localhost
PORT=5000
# ============================================================================
# SECURITY SETTINGS - WEEK 1
# ============================================================================
# JWT Authentication
JWT_SECRET_KEY=change-this-to-a-random-jwt-secret-in-production
JWT_ACCESS_TOKEN_EXPIRES=3600 # 1 hour in seconds
# Admin user password for /api/auth/login (required - no login possible if unset)
ADMIN_PASSWORD=change-this-to-a-strong-password
# Rate Limiting (Format: "X per Y" where Y: second, minute, hour, day)
RATELIMIT_ENABLED=True
RATELIMIT_CHAT=10 per minute
RATELIMIT_UPLOAD=5 per hour
RATELIMIT_MODELS=20 per minute
RATELIMIT_GENERAL=60 per minute
# CORS Settings (if needed for external access)
CORS_ENABLED=False
CORS_ORIGINS=http://localhost:3000,http://localhost:5000
# ============================================================================
# DATABASE CONFIGURATION
# ============================================================================
# PostgreSQL Connection
PG_HOST=localhost
PG_PORT=5432
PG_USER=postgres
PG_PASSWORD=your-password-here
PG_DB=rag_db
# Connection Pool
DB_POOL_MIN_CONN=2
DB_POOL_MAX_CONN=10
DB_POOL_TIMEOUT=5
# ============================================================================
# OLLAMA CONFIGURATION
# ============================================================================
OLLAMA_BASE_URL=http://localhost:11434
OLLAMA_TIMEOUT=120
OLLAMA_DEFAULT_MODEL=llama3.1:latest
OLLAMA_EMBEDDING_MODEL=nomic-embed-text:latest
# Preferred chat model selected at startup (prefix match, falls back to first available)
DEFAULT_MODEL=llama3.1
# Embedding request timeout — raise if CPU cold-start exceeds default
OLLAMA_EMBED_TIMEOUT=300
# Gunicorn worker timeout — must be >= OLLAMA_EMBED_TIMEOUT
GUNICORN_TIMEOUT=300
# ============================================================================
# RAG CONFIGURATION
# ============================================================================
# Chunking Settings
CHUNK_SIZE=768
CHUNK_OVERLAP=128
CHUNK_SEPARATORS=\n\n,\n,. , ,
# Retrieval Settings
TOP_K_RESULTS=15
MIN_SIMILARITY_THRESHOLD=0.25
RERANK_RESULTS=True
# Processing
MAX_WORKERS=4
MAX_UPLOAD_SIZE_MB=16
# ============================================================================
# LLM CONFIGURATION
# ============================================================================
DEFAULT_TEMPERATURE=0.0
MAX_CONTEXT_LENGTH=8192
STREAM_RESPONSES=True
# ============================================================================
# FILE UPLOAD CONFIGURATION
# ============================================================================
UPLOAD_FOLDER=uploads
ALLOWED_EXTENSIONS=.pdf,.txt,.docx,.md
MAX_FILE_SIZE=16777216 # 16MB in bytes
# ============================================================================
# LOGGING CONFIGURATION
# ============================================================================
LOG_LEVEL=INFO # DEBUG, INFO, WARNING, ERROR, CRITICAL
LOG_FILE=logs/app.log
LOG_MAX_SIZE=10485760 # 10MB
LOG_BACKUP_COUNT=5
LOG_FORMAT=%(asctime)s - %(name)s - %(levelname)s - %(message)s
# ============================================================================
# MONITORING & HEALTH CHECKS
# ============================================================================
HEALTH_CHECK_ENABLED=True
METRICS_ENABLED=False
# REQUIRED for non-localhost deployments: set a strong random token to protect
# the /api/metrics endpoint. Without this, metrics are publicly accessible.
# Generate with: python -c "import secrets; print(secrets.token_hex(32))"
METRICS_TOKEN=
# ============================================================================
# REDIS CONFIGURATION (Optional - for caching/sessions)
# ============================================================================
REDIS_ENABLED=False
REDIS_HOST=localhost
REDIS_PORT=6379
REDIS_DB=0
REDIS_PASSWORD=
# ============================================================================
# EMAIL CONFIGURATION (Optional - for notifications)
# ============================================================================
EMAIL_ENABLED=False
SMTP_HOST=smtp.gmail.com
SMTP_PORT=587
SMTP_USER=your-email@gmail.com
SMTP_PASSWORD=your-app-password
SMTP_FROM=noreply@localchat.local
# ============================================================================
# DEPLOYMENT SETTINGS
# ============================================================================
# Production settings
WORKERS=4 # Gunicorn workers
WORKER_CLASS=sync # sync, gevent, eventlet
WORKER_TIMEOUT=120