1
0
mirror of https://github.com/go-micro/go-micro.git synced 2025-05-31 21:59:42 +02:00

Add Handle option (#2627)

This commit is contained in:
Asim Aslam 2023-04-11 10:29:03 +01:00 committed by GitHub
parent d392e72021
commit d44ed328d1
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -112,6 +112,15 @@ func Context(ctx context.Context) Option {
}
}
// Handle will register a handler without any fuss
func Handle(v interface{}) Option {
return func(o *Options) {
o.Server.Handle(
o.Server.NewHandler(v),
)
}
}
// HandleSignal toggles automatic installation of the signal handler that
// traps TERM, INT, and QUIT. Users of this feature to disable the signal
// handler, should control liveness of the service through the context.