|
| 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. |
0 commit comments