-
Notifications
You must be signed in to change notification settings - Fork 34
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
Implement managed debug mode for tf5server and tf6server #137
Conversation
Reference: #134 This will allow providers and downstream SDK implementations to opt into a fully managed debug server, which manages reattach configuration handling and stop signals, rather than requiring duplicate logic that can be unclear to implement. The `tf5server` and `tf6server` implementations could use some refactoring to reduce _their_ duplicated code (e.g. a shared internal package), however that is left for future handling, especially with other in flight changes at the moment.
Verification notes (ensuring providers could be debugged successfully via VS Code):
if *debugFlag {
opts = append(opts, tf5server.WithManagedDebug())
}
// Serve serves a provider, blocking until the context is canceled.
func Serve(ctx context.Context, providerFunc func() Provider, opts ServeOpts) error {
var tf6serverOpts []tf6server.ServeOpt
if opts.Debug {
tf6serverOpts = append(tf6serverOpts, tf6server.WithManagedDebug())
}
return tf6server.Serve(opts.Name, func() tfprotov6.ProviderServer {
return &server{
p: providerFunc(),
}
}, tf6serverOpts...)
}
|
Co-authored-by: Kit Ewbank <Kit_Ewbank@hotmail.com>
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.
LGTM 🚀.
I'm going to lock this pull request because it has been closed for 30 days ⏳. This helps our maintainers find and focus on the active contributions. |
Closes #134
This will allow providers and downstream SDK implementations to opt into a fully managed debug server, which manages reattach configuration handling and stop signals, rather than requiring duplicate logic that can be unclear and/or verbose to implement.
The
tf5server
andtf6server
implementations could use some refactoring to reduce their duplicated code (e.g. a shared internal package), however that is left for future handling, especially with other in flight changes at the moment.