-
Notifications
You must be signed in to change notification settings - Fork 0
Atualizar branch com versão mais atual da main #6
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
Bumps [fastify](https://github.com/fastify/fastify) from 5.2.1 to 5.3.2. - [Release notes](https://github.com/fastify/fastify/releases) - [Commits](fastify/fastify@v5.2.1...v5.3.2) --- updated-dependencies: - dependency-name: fastify dependency-version: 5.3.2 dependency-type: direct:production ... Signed-off-by: dependabot[bot] <[email protected]>
chore(deps): Bump fastify from 5.2.1 to 5.3.2
a versão 5.3.2 corrige uma falha de segurança
- validar variáveis de ambiente com o Zod
configurar logs do Prisma para diferentes ambientes de execução
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.
Pull Request Overview
This PR synchronizes the branch with the latest main updates by centralizing configuration, introducing environment validation, and refactoring server setup.
- Refactor
server.tsto import the Fastify app and useenv.PORT - Add environment schema validation in
src/env/index.tsand configure Prisma logging - Extract error handling and route definitions into
src/app.ts - Bump Fastify version and add
dotenvdependency
Reviewed Changes
Copilot reviewed 6 out of 6 changed files in this pull request and generated 2 comments.
Show a summary per file
| File | Description |
|---|---|
| src/server.ts | Import centralized app, replace hardcoded port and logging |
| src/app.ts | Define routes and error handler in a dedicated module |
| src/env/index.ts | Add Zod-based schema validation for environment variables |
| src/lib/prisma.ts | Configure PrismaClient with environment-based logging levels |
| package.json | Upgrade Fastify and add dotenv dependency |
Comments suppressed due to low confidence (2)
src/env/index.ts:11
- [nitpick] Consider adding unit tests to cover environment validation failures, ensuring the application fails fast with clear errors when invalid variables are provided.
if (_env.success === false) {
src/app.ts:13
- [nitpick] The new error handler logic (especially the ZodError path and generic errors) should be exercised by tests to confirm correct status codes and response shapes.
app.setErrorHandler((error, _, reply) => {
| if (env.NODE_ENV !== 'prod') { | ||
| console.error(error) | ||
| } else { | ||
| console.error(error) |
Copilot
AI
May 21, 2025
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.
[nitpick] The console.error call is duplicated in both branches; consider logging the error once outside the condition and then adding any external logging only in the 'prod' branch to reduce duplication.
| if (env.NODE_ENV !== 'prod') { | |
| console.error(error) | |
| } else { | |
| console.error(error) | |
| console.error(error) | |
| if (env.NODE_ENV === 'prod') { |
| "@prisma/client": "^6.4.1", | ||
| "fastify": "^5.2.1", | ||
| "fastify": "^5.3.2", | ||
| "dotenv": "^16.5.0", |
Copilot
AI
May 21, 2025
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.
[nitpick] Since dotenv is primarily for local development, consider moving it to devDependencies if your production environments inject variables through the environment directly.
No description provided.