File size: 1,800 Bytes
dd5c695
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
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
# Setup Scripts

Utilities for initial setup and configuration validation.

## Environment Configuration

### `check_env_config.py` ⭐
**Validate your entire environment configuration before running the app.**

```bash
# Check configuration and show warnings
python scripts/setup/check_env_config.py

# Strict mode - exit with error if any issues found
python scripts/setup/check_env_config.py --strict
```

**What it checks:**
- βœ… Required variables (JWT_SECRET, CORS_ORIGINS, Google OAuth)
- ⚠️ Recommended variables (Gemini API, Razorpay, etc.)
- βš™οΈ Configuration values (token expiry, rate limits)
- πŸ”’ Security issues (production CORS, HTTPS)

**Run this before:**
- First time setup
- Deploying to production
- After changing .env file

---

## Secret Generation

### `generate_jwt_secret.py`
Generate cryptographically secure JWT secret keys.

```bash
# Basic usage
python scripts/setup/generate_jwt_secret.py

# Custom length
python scripts/setup/generate_jwt_secret.py --length 128

# Different output formats
python scripts/setup/generate_jwt_secret.py --format docker
python scripts/setup/generate_jwt_secret.py --format export
python scripts/setup/generate_jwt_secret.py --format raw
```

Add the generated secret to your `.env` file as `JWT_SECRET`.

---

## OAuth Setup

### `get_google_token.py`
Generate Google OAuth refresh tokens for Gmail and Drive services.

```bash
python scripts/setup/get_google_token.py
```

**Prerequisites:**
1. Download OAuth 2.0 credentials from [Google Cloud Console](https://console.cloud.google.com/apis/credentials)
2. Save as `client_secret.json` in project root
3. Run the script and follow browser authentication flow

**Outputs:**
- `GOOGLE_CLIENT_ID`
- `GOOGLE_CLIENT_SECRET`
- `GOOGLE_REFRESH_TOKEN`

Add these to your `.env` file.