Skip to content

Commit f211731

Browse files
authored
Merge pull request #258 from DevanshuNEU/fix/unify-env-vars
fix: unify env var configuration -- API_KEY mismatch, missing vars (OPE-72)
2 parents a69f505 + 9a2a031 commit f211731

4 files changed

Lines changed: 26 additions & 21 deletions

File tree

.env.example

Lines changed: 15 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -6,11 +6,10 @@
66
OPENAI_API_KEY=sk-...
77

88
# Embedding Model (Optional)
9-
# Options: text-embedding-3-small (faster, cheaper), text-embedding-3-large (better quality)
10-
# Default: text-embedding-3-large
11-
EMBEDDING_MODEL=text-embedding-3-large
9+
# Options: text-embedding-3-small (default, faster/cheaper), text-embedding-3-large (better quality)
10+
EMBEDDING_MODEL=text-embedding-3-small
1211

13-
# Pinecone API (Required)
12+
# Pinecone API (Required)
1413
# Get from: https://app.pinecone.io/
1514
PINECONE_API_KEY=pcsk_...
1615
PINECONE_INDEX_NAME=codeintel
@@ -19,13 +18,16 @@ PINECONE_INDEX_NAME=codeintel
1918
# Get from: https://app.supabase.com/project/_/settings/api
2019
SUPABASE_URL=https://your-project.supabase.co
2120
SUPABASE_ANON_KEY=eyJ...
22-
# From Project Settings -> API -> JWT Secret
2321
SUPABASE_JWT_SECRET=your-jwt-secret
24-
# From Project Settings -> API -> service_role key
2522
SUPABASE_SERVICE_ROLE_KEY=eyJ...
2623

27-
# Backend API
28-
API_KEY=change-this-secret-key-for-production
24+
# Development API Key (Optional -- dev/test only, ignored in production)
25+
# Used to bypass JWT auth when DEBUG=true. Never set in production.
26+
DEV_API_KEY=
27+
DEBUG=false
28+
LOG_LEVEL=INFO
29+
30+
# Backend API URL (used by MCP server and frontend)
2931
BACKEND_API_URL=http://backend:8000
3032
FRONTEND_URL=http://localhost:3000
3133

@@ -37,31 +39,28 @@ GITHUB_REDIRECT_URI=http://localhost:3000/auth/github/callback
3739

3840
# CORS Configuration (Security)
3941
# Comma-separated list of allowed origins
40-
# Development: http://localhost:3000
41-
# Production: https://your-app.vercel.app,https://your-domain.com
4242
ALLOWED_ORIGINS=http://localhost:3000
4343

4444
# Redis (auto-configured in Docker, set REDIS_URL in Railway)
4545
REDIS_HOST=redis
4646
REDIS_PORT=6379
47+
REDIS_URL=
4748

4849
# Sentry Error Tracking (Optional but recommended for production)
4950
# Get DSN from: https://sentry.io -> Settings -> Projects -> Client Keys
5051
SENTRY_DSN=
5152
SENTRY_SEND_PII=false
5253
SENTRY_INCLUDE_LOCAL_VARS=false
53-
ENVIRONMENT=development # development, staging, production
54+
ENVIRONMENT=development
5455

55-
# Discord Webhook (Optional - for feedback notifications)
56+
# Discord Webhook (Optional -- for feedback notifications)
5657
DISCORD_FEEDBACK_WEBHOOK=
5758

58-
# Search V2 Configuration
59-
# Cohere API for reranking (Optional - improves search quality)
59+
# Cohere API for reranking (Optional -- improves search quality)
6060
# Get from: https://dashboard.cohere.com/api-keys
61-
# Free tier: 10K requests/month
6261
COHERE_API_KEY=
6362
SEARCH_V2_ENABLED=true
6463

65-
# Voyage AI - code-specific embeddings (Optional - improves code search quality)
64+
# Voyage AI (Optional -- code-specific embeddings for better search)
6665
# Get from: https://dash.voyageai.com/
6766
VOYAGE_API_KEY=

backend/config/startup_checks.py

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -26,6 +26,9 @@
2626
("SENTRY_SEND_PII", "Send user emails to Sentry", "PII disabled (privacy safe)"),
2727
("SENTRY_INCLUDE_LOCAL_VARS", "Include local vars in Sentry traces", "Local vars excluded"),
2828
("REDIS_HOST", "Redis host for caching", "Using default localhost"),
29+
("GITHUB_CLIENT_ID", "GitHub OAuth client ID", "GitHub repo import disabled"),
30+
("GITHUB_CLIENT_SECRET", "GitHub OAuth client secret", "GitHub repo import disabled"),
31+
("DISCORD_FEEDBACK_WEBHOOK", "Discord webhook for feedback", "Feedback notifications disabled"),
2932
]
3033

3134

backend/tests/conftest.py

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -10,13 +10,11 @@
1010

1111
# Set test environment BEFORE imports
1212
os.environ["DEBUG"] = "true"
13-
os.environ["DEV_API_KEY"] = "test-secret-key" # New env var for dev key
14-
os.environ["API_KEY"] = "test-secret-key" # Legacy support
13+
os.environ["DEV_API_KEY"] = "test-secret-key"
1514
os.environ["OPENAI_API_KEY"] = "sk-test-key"
1615
os.environ["PINECONE_API_KEY"] = "pcsk-test"
1716
os.environ["PINECONE_INDEX_NAME"] = "test-index"
1817
os.environ["SUPABASE_URL"] = "https://test.supabase.co"
19-
os.environ["SUPABASE_KEY"] = "test-key"
2018
os.environ["SUPABASE_ANON_KEY"] = "test-anon-key"
2119
os.environ["SUPABASE_JWT_SECRET"] = "test-jwt-secret"
2220

docker-compose.yml

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,13 @@ services:
3535
- SUPABASE_ANON_KEY=${SUPABASE_ANON_KEY}
3636
- SUPABASE_JWT_SECRET=${SUPABASE_JWT_SECRET}
3737
- SUPABASE_SERVICE_ROLE_KEY=${SUPABASE_SERVICE_ROLE_KEY}
38-
- API_KEY=${API_KEY}
38+
- DEV_API_KEY=${DEV_API_KEY}
39+
- DEBUG=${DEBUG:-false}
40+
- EMBEDDING_MODEL=${EMBEDDING_MODEL:-text-embedding-3-small}
41+
- LOG_LEVEL=${LOG_LEVEL:-INFO}
42+
- GITHUB_CLIENT_ID=${GITHUB_CLIENT_ID}
43+
- GITHUB_CLIENT_SECRET=${GITHUB_CLIENT_SECRET}
44+
- GITHUB_REDIRECT_URI=${GITHUB_REDIRECT_URI}
3945
- BACKEND_API_URL=http://backend:8000
4046
- DISCORD_FEEDBACK_WEBHOOK=${DISCORD_FEEDBACK_WEBHOOK}
4147
- COHERE_API_KEY=${COHERE_API_KEY}
@@ -96,7 +102,6 @@ services:
96102
# - "8001:8001"
97103
# environment:
98104
# - BACKEND_API_URL=http://backend:8000
99-
# - API_KEY=${API_KEY}
100105
# depends_on:
101106
# - backend
102107
# networks:

0 commit comments

Comments
 (0)