chore: add .env support with gitignore protection#3283
chore: add .env support with gitignore protection#3283PierreBrisorgueil merged 3 commits intomasterfrom
Conversation
Add .env/.env.* to gitignore to prevent secret leaks, provide .env.example with all billing env vars, and use Node 22 --env-file flag in start/dev scripts for automatic loading.
|
Warning Rate limit exceeded
⌛ 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. ℹ️ Review info⚙️ Run configurationConfiguration used: Path: .coderabbit.yaml Review profile: ASSERTIVE Plan: Pro Run ID: 📒 Files selected for processing (1)
WalkthroughAdds an example environment file with Stripe Billing variable placeholders, updates .gitignore to ignore real env files while keeping the example, and modifies package.json scripts to optionally load Changes
Estimated code review effort🎯 2 (Simple) | ⏱️ ~8 minutes Possibly related PRs
🚥 Pre-merge checks | ✅ 2 | ❌ 1❌ Failed checks (1 inconclusive)
✅ Passed checks (2 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. ✨ Finishing Touches🧪 Generate unit tests (beta)
📝 Coding Plan
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.
Pull request overview
This PR adds first-class local environment file support while protecting secrets from being committed, and documents the required Stripe billing environment variables.
Changes:
- Update
start/devscripts to load environment variables from.envvia Node’s--env-file. - Add
.env/.env.*to.gitignorewhile explicitly allowing.env.example. - Add
.env.exampledocumenting Stripe billing-relatedDEVKIT_NODE_*variables.
Reviewed changes
Copilot reviewed 2 out of 3 changed files in this pull request and generated 1 comment.
| File | Description |
|---|---|
| package.json | Load env vars from .env automatically for start and dev. |
| .gitignore | Prevent accidental commits of .env files while keeping .env.example tracked. |
| .env.example | Provide documented placeholders for Stripe billing configuration. |
There was a problem hiding this comment.
Actionable comments posted: 1
🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.
Inline comments:
In `@package.json`:
- Around line 26-27: The package.json scripts "start" and "dev" hard-fail when
.env is missing because they use --env-file=.env; change both scripts to use
--env-file-if-exists=.env so Node 22 will load the file only if present (i.e.,
update the "start" and "dev" script values to replace --env-file=.env with
--env-file-if-exists=.env).
🪄 Autofix (Beta)
Fix all unresolved CodeRabbit comments on this PR:
- Push a commit to this branch (recommended)
- Create a new PR with the fixes
ℹ️ Review info
⚙️ Run configuration
Configuration used: Path: .coderabbit.yaml
Review profile: ASSERTIVE
Plan: Pro
Run ID: 26e6c83a-5af3-4797-8a55-436f97ccb49c
📒 Files selected for processing (3)
.env.example.gitignorepackage.json
… scripts start/dev remain unchanged so the app works without Stripe. start:billing/dev:billing load .env for Stripe testing.
Summary
.envand.env.*to.gitignoreto prevent accidental secret commits (.env.exampleexcluded).env.examplewith allDEVKIT_NODE_stripe_*billing variables as documentationstartanddevscripts to use Node 22's--env-file=.envfor automatic env loadingTest plan
.envwith real values is NOT tracked by git.env.exampleIS tracked by gitnpm startloads env vars from.envcorrectlySummary by CodeRabbit