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

Introduce server config method(s) #76

Merged
merged 29 commits into from
Jun 25, 2024

Conversation

shan-96
Copy link
Contributor

@shan-96 shan-96 commented Jun 8, 2024

Closes #68

  • Add server config into Server's contract
  • Add this into context's data

server/wasabi_context.go Outdated Show resolved Hide resolved
@codecov-commenter
Copy link

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 91.58%. Comparing base (05d6c27) to head (6adad7f).
Report is 3 commits behind head on main.

Additional details and impacted files
@@            Coverage Diff             @@
##             main      #76      +/-   ##
==========================================
+ Coverage   91.31%   91.58%   +0.27%     
==========================================
  Files          20       21       +1     
  Lines         829      844      +15     
==========================================
+ Hits          757      773      +16     
+ Misses         53       52       -1     
  Partials       19       19              

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

@shan-96
Copy link
Contributor Author

shan-96 commented Jun 23, 2024

@ksysoev sorry for the delay. This PR is ready for review. I have changed a few things

  • keep using stdlib context
  • ensure context is populated with required values at runtime
  • ensure type safety by adding the config into server constructor

.golangci.yml Outdated Show resolved Hide resolved
server/server.go Outdated Show resolved Hide resolved
server/server.go Outdated
@@ -69,7 +64,7 @@ func WithReadinessChan(ch chan<- struct{}) Option {
// NewServer creates new instance of Wasabi server
// port - port to listen on
// returns new instance of Server
func NewServer(addr string, opts ...Option) *Server {
func NewServer(addr string, serverConfig ServerConfig, opts ...Option) *Server {
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Let's not introduce new mandatory arguments, I think in majority of cases these timeouts don't need to be redefined and reasonable default can be use without bothering the user. I'd suggest to pass it as optional parameter.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

added an optional method

server/server_config.go Outdated Show resolved Hide resolved
@shan-96 shan-96 changed the title Introduce wasabi context Introduce server config method(s) Jun 24, 2024
server/server.go Outdated Show resolved Hide resolved
Copy link
Owner

@ksysoev ksysoev left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM, Thanks for the contribution

@ksysoev ksysoev merged commit 1257dbd into ksysoev:main Jun 25, 2024
2 checks passed
@shan-96 shan-96 deleted the 68-add-typed-context-interface branch June 26, 2024 17:14
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.

Add support to use custom configuration
3 participants