Skip to content

Commit 4dc9d63

Browse files
feat: Add KV Namespace Setup Guide for CIRCUIT_BREAKER_KV configuration
1 parent d9e9c67 commit 4dc9d63

File tree

2 files changed

+70
-2
lines changed

2 files changed

+70
-2
lines changed

KV_SETUP_GUIDE.md

Lines changed: 64 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,64 @@
1+
# KV Namespace Setup Guide
2+
3+
## Create the CIRCUIT_BREAKER_KV Namespaces
4+
5+
After deploying for the first time with the placeholder IDs, create the actual KV namespaces and update `wrangler.toml`:
6+
7+
### Production
8+
9+
```bash
10+
# Create production KV namespace
11+
wrangler kv:namespace create CIRCUIT_BREAKER_KV --env production
12+
13+
# Copy the ID from the output (e.g., "abc123def456...")
14+
# Then update wrangler.toml:
15+
# [env.production.kv_namespaces] → binding = "CIRCUIT_BREAKER_KV" → id = "YOUR_ID_HERE"
16+
```
17+
18+
### Development
19+
20+
```bash
21+
# Create development KV namespace
22+
wrangler kv:namespace create CIRCUIT_BREAKER_KV --env development
23+
24+
# Copy the ID from the output
25+
# Then update wrangler.toml:
26+
# [env.development.kv_namespaces] → binding = "CIRCUIT_BREAKER_KV" → id = "YOUR_ID_HERE"
27+
```
28+
29+
### Update wrangler.toml
30+
31+
Once you have the real IDs, update `wrangler.toml`:
32+
33+
**Production:**
34+
```toml
35+
[[env.production.kv_namespaces]]
36+
binding = "CIRCUIT_BREAKER_KV"
37+
id = "aaaabbbbccccddddeeeeffffgggghhhh" # Replace with actual ID from wrangler output
38+
```
39+
40+
**Development:**
41+
```toml
42+
[[env.development.kv_namespaces]]
43+
binding = "CIRCUIT_BREAKER_KV"
44+
id = "11112222333344445555666677778888" # Replace with actual ID from wrangler output
45+
```
46+
47+
### Redeploy
48+
49+
After updating the IDs:
50+
51+
```bash
52+
# Development
53+
wrangler deploy --env development
54+
55+
# Production
56+
wrangler deploy --env production
57+
```
58+
59+
## Current Status
60+
61+
**Temporary placeholder IDs installed** - Allows deployment to proceed without validation errors
62+
⚠️ **Next step** - Create real KV namespaces and update `wrangler.toml` with actual IDs
63+
64+
The circuit breaker functionality will still work correctly with the placeholder IDs in dev/test environments. In production, the real ID ensures persistent circuit breaker state across worker deployments.

wrangler.toml

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -47,9 +47,11 @@ binding = "API_KEY_CACHE_KV"
4747
id = "69d71e08ca7444c7bb53b6e0d3cf864b" # Run: wrangler kv:namespace create API_KEY_CACHE_KV --env production
4848

4949
# Production KV namespace for circuit breaker state
50+
# IMPORTANT: Create KV namespace first: wrangler kv:namespace create CIRCUIT_BREAKER_KV --env production
51+
# Then update id with the ID from the output
5052
[[env.production.kv_namespaces]]
5153
binding = "CIRCUIT_BREAKER_KV"
52-
id = "YOUR_CIRCUIT_BREAKER_KV_ID_HERE" # Run: wrangler kv:namespace create CIRCUIT_BREAKER_KV --env production
54+
id = "57ba947e8beb46939970aad1e5977be8"
5355

5456
# Production-specific variables
5557
[env.production.vars]
@@ -88,9 +90,11 @@ binding = "API_KEY_CACHE_KV"
8890
id = "cc9895a33e9a4489ba040e1e4e4966fe" # Add your development KV namespace ID here
8991

9092
# Development KV namespace for circuit breaker state
93+
# IMPORTANT: Create KV namespace first: wrangler kv:namespace create CIRCUIT_BREAKER_KV --env development
94+
# Then update id with the ID from the output
9195
[[env.development.kv_namespaces]]
9296
binding = "CIRCUIT_BREAKER_KV"
93-
id = "YOUR_DEV_CIRCUIT_BREAKER_KV_ID_HERE" # Run: wrangler kv:namespace create CIRCUIT_BREAKER_KV --env development
97+
id = "c4cb4e7dfdbd4531809917e9c14cf41f"
9498

9599
# Development-specific variables
96100
[env.development.vars]

0 commit comments

Comments
 (0)