-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy path.env.example
More file actions
84 lines (79 loc) · 2.7 KB
/
.env.example
File metadata and controls
84 lines (79 loc) · 2.7 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
# Cloudflare Account Configuration
# Get these from: https://dash.cloudflare.com/
CLOUDFLARE_ACCOUNT_ID=your-account-id-here
CLOUDFLARE_API_TOKEN=your-api-token-here
# D1 Database IDs
# Create databases with: wrangler d1 create <database-name>
# Development database
CLOUDFLARE_DATABASE_ID=your-development-database-id-here
# Production database (optional)
CLOUDFLARE_DATABASE_ID_PROD=your-production-database-id-here
# Migration Configuration
# The database name to use for migrations (should match wrangler.toml)
D1_DATABASE_NAME=refine-sqlx-db
# Development Mode
# Set to 'true' for dry-run mode (preview without applying changes)
DRY_RUN=false
# ==============================================================================
# Setup Instructions
# ==============================================================================
#
# 1. Create Cloudflare API Token:
# - Go to: https://dash.cloudflare.com/profile/api-tokens
# - Click "Create Token"
# - Use "Edit Cloudflare Workers" template
# - Add permissions: D1:Edit, Workers Scripts:Edit
# - Copy the token and set CLOUDFLARE_API_TOKEN
#
# 2. Get Account ID:
# - Go to: https://dash.cloudflare.com/
# - Select any domain or Workers & Pages
# - Copy Account ID from the right sidebar
# - Set CLOUDFLARE_ACCOUNT_ID
#
# 3. Create D1 Databases:
# # Development
# wrangler d1 create refine-sqlx-db-dev
#
# # Production
# wrangler d1 create refine-sqlx-db-prod
#
# Copy the database IDs from the output
#
# 4. Update wrangler.toml:
# - Copy wrangler.toml.example to wrangler.toml
# - Replace database_id values with your actual IDs
#
# 5. Test Configuration:
# # Verify wrangler can connect
# wrangler d1 list
#
# # Test database access
# wrangler d1 execute refine-sqlx-db-dev --command="SELECT 1"
#
# ==============================================================================
# Usage Examples
# ==============================================================================
#
# Generate migrations:
# bun run db:generate:d1
#
# Apply migrations (development):
# D1_DATABASE_NAME=refine-sqlx-db-dev bun run db:migrate:d1
#
# Apply migrations (production):
# D1_DATABASE_NAME=refine-sqlx-db-prod bun run db:migrate:d1
#
# Dry run (preview changes):
# DRY_RUN=true D1_DATABASE_NAME=refine-sqlx-db-dev bun run db:migrate:d1
#
# ==============================================================================
# Security Notes
# ==============================================================================
#
# ⚠️ NEVER commit this file with real credentials!
# ✅ Add .env to .gitignore
# ✅ Use separate tokens for development and production
# ✅ Rotate tokens regularly
# ✅ Use minimum required permissions for tokens
#