refactor: replace hardcoded database ID with environment variable#18
refactor: replace hardcoded database ID with environment variable#18jezweb wants to merge 1 commit intoifindev:mainfrom
Conversation
Replace hardcoded D1 database ID in drizzle.config.ts with CLOUDFLARE_D1_DATABASE_ID environment variable for better configurability across different environments. Changes: - Add CLOUDFLARE_D1_DATABASE_ID to .dev.vars.example - Update drizzle.config.ts to use env var instead of hardcoded ID - Document the new env var in README.md with instructions - Add note about copying database_id when creating D1 database This allows developers to easily switch between different databases (dev/staging/prod) without modifying code. Note: wrangler.jsonc still requires the actual database_id value as it doesn't support environment variable interpolation. 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude <noreply@anthropic.com>
|
Warning Rate limit exceeded@jezweb has exceeded the limit for the number of commits or files that can be reviewed per hour. Please wait 9 minutes and 50 seconds before requesting another review. ⌛ How to resolve this issue?After the wait time has elapsed, a review can be triggered using the We recommend that you space out your commits to avoid hitting the rate limit. 🚦 How do rate limits work?CodeRabbit enforces hourly rate limits for each developer per organization. Our paid plans have higher rate limits than the trial, open-source and free plans. In all cases, we re-allow further reviews after a brief timeout. Please see our FAQ for further information. 📒 Files selected for processing (4)
✨ Finishing touches
🧪 Generate unit tests (beta)
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
There was a problem hiding this comment.
We don't need this file, can you remove it?
Problem
The D1 database ID was hardcoded in
drizzle.config.ts, making it difficult to:Solution
Replace the hardcoded ID with
CLOUDFLARE_D1_DATABASE_IDenvironment variable.Changes
drizzle.config.ts: Useprocess.env.CLOUDFLARE_D1_DATABASE_IDinstead of hardcoded value.dev.vars.example: AddCLOUDFLARE_D1_DATABASE_IDwith instructionsREADME.md: Document the new environment variable in multiple places:Impact
Developers can now easily configure different database instances per environment without modifying code. The
wrangler.jsoncfile still requires the actual database_id value as Wrangler doesn't support env var interpolation in config files.🤖 Generated with Claude Code