Repository navigation
Expand file tree
/
Copy path.env.example
More file actions
67 lines (49 loc) · 1.5 KB
/
Copy path.env.example
File metadata and controls
67 lines (49 loc) · 1.5 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
# Environment Setup
This file documents required environment variables for local development and production builds.
## Local Development (.env.local)
```env
# Vite mode
VITE_APP_ENV=development
# API endpoints
VITE_API_BASE_URL=http://localhost:3000/api
VITE_RSS_PROXY_URL=http://localhost:3000/proxy
# Feature flags
VITE_ENABLE_ANALYTICS=false
VITE_ENABLE_NOTIFICATIONS=true
VITE_DEBUG_LOGGING=true
# App version (used for cache versioning)
VITE_APP_VERSION=0.1.0
```
## Production (.env.production)
```env
# Vite mode
VITE_APP_ENV=production
# API endpoints (update with actual production URLs)
VITE_API_BASE_URL=https://api.rss-reader.app
VITE_RSS_PROXY_URL=https://api.rss-reader.app/proxy
# Feature flags
VITE_ENABLE_ANALYTICS=true
VITE_ENABLE_NOTIFICATIONS=true
VITE_DEBUG_LOGGING=false
# App version
VITE_APP_VERSION=0.1.0
```
## Using Environment Variables
In your code, access variables using `import.meta.env`:
```typescript
// src/services/api.ts
const apiUrl = import.meta.env.VITE_API_BASE_URL;
const isDevelopment = import.meta.env.DEV;
const isProduction = import.meta.env.PROD;
if (import.meta.env.VITE_DEBUG_LOGGING) {
logger.debug('Debug mode enabled');
}
```
## Notes
- Environment variables must start with `VITE_` to be exposed to client-side code
- Never commit `.env.local` files (add to `.gitignore`)
- Production builds automatically strip debug logging
- Service Worker respects app version for cache busting
AI_API_KEY=your_api_key_here
AI_BASE_URL=https://api.openai.com/v1
AI_MODEL=glm-5