Skip to content
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

feat: refactor application to support gRPC configuration #18

Merged
merged 4 commits into from
Jul 29, 2024

Conversation

blackhorseya
Copy link
Owner

No description provided.

- Add a new file `cmd/start.go` with `startCmd` representing the start command

Signed-off-by: Sean Zheng <[email protected]>
- Update return type in GetService function from adapterx.Restful to adapterx.Service

Signed-off-by: Sean Zheng <[email protected]>
- Add a new file `impl.go` in the `adapter/block/grpc` directory
- Add a new file `wire.go` in the `adapter/block/grpc` directory
- Add a new file `wire_gen.go` in the `adapter/block/grpc` directory
- Modify the `cmd/start.go` file in the `cmd` directory

Signed-off-by: Sean Zheng <[email protected]>
- Add a new `GRPC` struct and related methods to handle gRPC configuration in `app.go`
- Update the `Application` struct to include the new `GRPC` configuration
- Implement a `GetAddr` method in the `GRPC` struct to get the gRPC address

Signed-off-by: Sean Zheng <[email protected]>
@blackhorseya blackhorseya self-assigned this Jul 29, 2024
Copy link

sonarcloud bot commented Jul 29, 2024

Quality Gate Failed Quality Gate failed

Failed conditions
17.2% Duplication on New Code (required ≤ 3%)

See analysis details on SonarCloud

Copy link

Risk Level 2 - /home/runner/work/ryze/ryze/adapter/block/grpc/wire.go

The New function uses panic with wire.Build. This is acceptable for code generation but should be handled gracefully in production. Ensure that the generated code is reviewed and tested thoroughly.


Risk Level 2 - /home/runner/work/ryze/ryze/adapter/block/grpc/impl.go

The Start and AwaitSignal methods currently panic with a 'not implemented' message. This is acceptable for a work-in-progress but should be addressed before production. Consider adding a more descriptive error message or a temporary implementation to avoid runtime panics.


Risk Level 2 - /home/runner/work/ryze/ryze/app/infra/configx/app.go

The GetAddr method for the GRPC struct sets default values for Host and Port if they are not provided. This is a good practice, but ensure that netx.GetAvailablePort() is reliable and does not introduce any race conditions. Example:

if x.Port == 0 {
\tx.Port = netx.GetAvailablePort()
}

🔍⚠️


Powered by Code Review GPT

@blackhorseya blackhorseya merged commit bf03559 into main Jul 29, 2024
3 of 4 checks passed
@blackhorseya blackhorseya deleted the feature/add-config branch July 29, 2024 01:46
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant