-
Notifications
You must be signed in to change notification settings - Fork 137
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
Refactor grpc-server package #598
Conversation
Codecov Report
@@ Coverage Diff @@
## main #598 +/- ##
==========================================
+ Coverage 45.68% 45.96% +0.28%
==========================================
Files 55 56 +1
Lines 3301 3283 -18
==========================================
+ Hits 1508 1509 +1
+ Misses 1707 1684 -23
- Partials 86 90 +4
Continue to review full report at Codecov.
|
6945553
to
e3588d5
Compare
// The public key is expected to be named "bundle.pem" and the private key | ||
// "server.pem". | ||
func GetCerts(certsDir string) (*tls.Certificate, []byte, *time.Time, error) { | ||
certFile, err := os.Open(filepath.Join(certsDir, "bundle.pem")) |
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.
G304: Potential file inclusion via variable
(at-me in a reply with help
or ignore
)
669634c
to
dc23bb2
Compare
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.
This looks good to me.
I left some comments that largely focused on implementing TinkServer as server/Server, server/NewServer (with options helper moving that way) since the grpc-server/
parentage seems unnecessary.
c7afe78
to
ae45cce
Compare
addr, err := grpcserver.SetupGRPC( | ||
ctx, | ||
tinkAPI, | ||
config.GRPCAuthority, | ||
grpcOpts, | ||
errCh) | ||
if err != nil { | ||
return err | ||
} | ||
cert, modT := grpcServer.SetupGRPC(ctx, logger, grpcConfig, errCh) | ||
logger.With("address", addr).Info("started listener") | ||
|
||
httpConfig := &httpServer.Config{ | ||
httpConfig := &httpserver.Config{ | ||
HTTPAuthority: config.HTTPAuthority, | ||
CertPEM: cert, | ||
ModTime: modT, | ||
CertPEM: certPEM, | ||
ModTime: *certModTime, | ||
} | ||
httpServer.SetupHTTP(ctx, logger, httpConfig, errCh) | ||
httpserver.SetupHTTP(ctx, logger, httpConfig, errCh) | ||
|
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.
This could really benefit from using https://github.com/oklog/run. Unnecessary for this PR, but if you get time separately it would help clean up the subsequent error channel code that does static draining of the channel.
7f702d0
to
4a9e988
Compare
* Untangle certificate acquisition * Make gRPC server accept different registrable APIs * Move postgres setup logic out of tink-server's main.go to an internal package * Move gRPC server implementation to the new /server package * Remove unused global workflowData Signed-off-by: Micah Hausler <[email protected]>
4a9e988
to
dbf5c4b
Compare
Description
workflowData
Why is this needed
This will facilitate swapping out the current gRPC API implementation with an alternative in a successive PR.
Fixes: #
How Has This Been Tested?
I will have a secondary PR adding end-to-end tests
How are existing users impacted? What migration steps/scripts do we need?
Anyone importing or instantiating the
grpcserver.SetupGRPC
withgrpserver.ConfigGRPCServer
will need to use the new signature and pass in agrpcserver.Registrar
such asserver.DBServer
.Previously this looked like:
And now, this looks like:
Checklist:
I have: