-
Notifications
You must be signed in to change notification settings - Fork 10
Expand file tree
/
Copy pathwrangler.toml.example
More file actions
127 lines (113 loc) · 4.2 KB
/
wrangler.toml.example
File metadata and controls
127 lines (113 loc) · 4.2 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
# Cloudflare R2 Bucket Manager - Wrangler Configuration Template
# Copy this file to wrangler.toml and customize for your Cloudflare account
#
# NOTE: This is the PRODUCTION configuration.
# For local development, use wrangler.dev.toml instead.
name = "r2"
main = "worker/index.ts"
compatibility_date = "2025-01-01"
compatibility_flags = ["nodejs_compat"]
workers_dev = true # Enable *.workers.dev subdomain
preview_urls = true # Enable preview URLs for each version
# Smart Placement disabled for SPA - UI responsiveness priority
placement = { mode = "off" }
[build]
command = "npm run build"
cwd = "."
[assets]
directory = "dist"
binding = "ASSETS"
# ============================================
# R2 BUCKET CONFIGURATION
# ============================================
# Replace with your R2 bucket name
# Create bucket: wrangler r2 bucket create <bucket-name>
[[r2_buckets]]
binding = "R2"
bucket_name = "your-bucket-name" # CHANGE THIS
# ============================================
# D1 METADATA DATABASE CONFIGURATION
# ============================================
# This database stores job history for bulk operations
# Create database: wrangler d1 create r2-manager-metadata
# Then run: wrangler d1 execute r2-manager-metadata --remote --file=worker/schema.sql
[[d1_databases]]
binding = "METADATA"
database_name = "r2-manager-metadata" # CHANGE THIS
database_id = "your-metadata-database-id" # CHANGE THIS (from wrangler d1 create output)
[observability.logs]
enabled = true
# ============================================
# AI BINDING CONFIGURATION (for AI Search)
# ============================================
# Enable AI binding for querying AI Search instances
# Requires an AI Search instance to be created via Dashboard first
[ai]
binding = "AI"
# ============================================
# RATE LIMITING CONFIGURATION
# ============================================
# Rate limiting bindings for API endpoint protection
# Requires Wrangler 4.36.0 or later
#
# Three tiers of rate limiting:
# - READ: 600 requests per 60 seconds (GET operations)
# - WRITE: 200 requests per 60 seconds (POST/PATCH operations)
# - DELETE: 60 requests per 60 seconds (DELETE operations)
#
# Rate limits are per-user (identified by email) per Cloudflare location
# and are eventually consistent across the network.
[[ratelimits]]
name = "RATE_LIMITER_READ"
namespace_id = "1001"
simple = { limit = 600, period = 60 }
[[ratelimits]]
name = "RATE_LIMITER_WRITE"
namespace_id = "1002"
simple = { limit = 200, period = 60 }
[[ratelimits]]
name = "RATE_LIMITER_DELETE"
namespace_id = "1003"
simple = { limit = 60, period = 60 }
# ============================================
# CUSTOM DOMAIN ROUTING (OPTIONAL)
# ============================================
# Option 1: Use default Workers.dev subdomain (no configuration needed)
# Your worker will be available at: https://r2.<your-subdomain>.workers.dev
#
# Option 2: Use custom domain (uncomment and configure below)
# Requirements:
# - Domain must be added to your Cloudflare account
# - DNS must be managed by Cloudflare
#
# [[routes]]
# pattern = "your-subdomain.your-domain.com" # CHANGE THIS
# custom_domain = true
# zone_name = "your-domain.com" # CHANGE THIS
# ============================================
# REQUIRED SECRETS (Set via CLI)
# ============================================
# Run these commands to set your secrets:
#
# wrangler secret put ACCOUNT_ID
# wrangler secret put CF_EMAIL
# wrangler secret put API_KEY
# wrangler secret put TEAM_DOMAIN
# wrangler secret put POLICY_AUD
#
# Secret details:
# - ACCOUNT_ID: Your Cloudflare account ID (Dashboard > Overview)
# - CF_EMAIL: Your Cloudflare account email
# - API_KEY: Cloudflare API token with R2 permissions
# - TEAM_DOMAIN: Cloudflare Zero Trust team domain (e.g., yourteam.cloudflareaccess.com)
# - POLICY_AUD: Access Policy AUD tag from your Access application
#
# ============================================
# LOCAL DEVELOPMENT
# ============================================
# For local development, use wrangler.dev.toml instead of this file.
# See README.md "Local Development" section for instructions.
#
# Quick start:
# Terminal 1: npm run dev
# Terminal 2: npx wrangler dev --config wrangler.dev.toml --local