-
Notifications
You must be signed in to change notification settings - Fork 22
feat: add reject request flag #146
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
WalkthroughA preview mode feature is introduced across the NestJS template through configuration updates, module initialization logic, and request guard modifications. The endpoint startup script is simplified, and Docker configuration adjusted to support the new mode. Changes
Estimated code review effort🎯 2 (Simple) | ⏱️ ~12 minutes
Poem
Pre-merge checks and finishing touches✅ Passed checks (3 passed)
✨ 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.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Actionable comments posted: 1
🧹 Nitpick comments (1)
template/nestJs/.env.example (1)
20-21: PREVIEW_MODE sample is clear; optionally reorder to satisfy dotenv-linterThe new comment and
PREVIEW_MODE=truesample clearly document the demo-mode toggle. dotenv-linter suggests placing PREVIEW_MODE beforeREDIS_HOST; if your CI enforces this, consider reordering:-AUTH_SECRET = 'secret' -REDIS_SECONDS = 7200 -REDIS_HOST = 'localhost' -REDIS_PORT = 6379 +AUTH_SECRET = 'secret' +REDIS_SECONDS = 7200 +# 是否启用演示模式 +PREVIEW_MODE=true +REDIS_HOST = 'localhost' +REDIS_PORT = 6379 ... -# 是否启用演示模式 -PREVIEW_MODE=trueOtherwise, the current change is fine.
📜 Review details
Configuration used: CodeRabbit UI
Review profile: CHILL
Plan: Pro
📒 Files selected for processing (6)
template/nestJs/.env.example(1 hunks)template/nestJs/dockerfile(1 hunks)template/nestJs/endpoint.sh(0 hunks)template/nestJs/src/app.module.ts(2 hunks)template/nestJs/src/config-schema.ts(2 hunks)template/nestJs/src/public/reject.guard.ts(1 hunks)
💤 Files with no reviewable changes (1)
- template/nestJs/endpoint.sh
🧰 Additional context used
🧬 Code graph analysis (2)
template/nestJs/src/public/reject.guard.ts (1)
template/nestJs/src/config-schema.ts (1)
Configure(3-23)
template/nestJs/src/app.module.ts (1)
template/nestJs/src/config-schema.ts (1)
Configure(3-23)
🪛 dotenv-linter (4.0.0)
template/nestJs/.env.example
[warning] 21-21: [UnorderedKey] The PREVIEW_MODE key should go before the REDIS_HOST key
(UnorderedKey)
⏰ Context from checks skipped due to timeout of 90000ms. You can increase the timeout in your CodeRabbit configuration to a maximum of 15 minutes (900000ms). (1)
- GitHub Check: e2e-test
🔇 Additional comments (3)
template/nestJs/dockerfile (1)
27-27: Explicit./endpoint.shin CMD is correctUsing an explicit relative path makes the script invocation more reliable inside the container; this change looks good.
template/nestJs/src/config-schema.ts (1)
22-23: Config type and schema extension for PREVIEW_MODE look consistentAdding
PREVIEW_MODE: booleantoConfigureand wiring it intoCONFIG_SCHEMAwith a boolean default oftrueis consistent and aligns with how it’s used inAppModuleand the guard.Also applies to: 43-44
template/nestJs/src/public/reject.guard.ts (1)
11-13: Guard gating on PREVIEW_MODE matches the intended behaviorInjecting config and returning early when
PREVIEW_MODEis disabled cleanly turns off the preview rejection behavior while preserving the existing i18n error path when preview mode is on. This aligns well with the PR objective of toggling demo mode via an env flag.Also applies to: 16-20, 22-24
|
/cmd docker --check |
🐳 Docker Check Status
Status: ⏳ Building... Preparing environment and running Docker health checks. |
✅ Docker Check Status
Status: SUCCESS! Service is built, running, and responded to health check on |
PR
PR Checklist
Please check if your PR fulfills the following requirements:
PR Type
What kind of change does this PR introduce?
What is the current behavior?
用户必须注释
RejectRequestGuard才可以禁用演示模式Issue Number: N/A
What is the new behavior?
用户只需要配置
PREVIEW_MODE=true/false即可以在运行时动态开启是否使用演示模式。如果为true,那么后端命令行会有相关提示Does this PR introduce a breaking change?
Other information
Summary by CodeRabbit
Release Notes
New Features
Configuration
Changes
✏️ Tip: You can customize this high-level summary in your review settings.