-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathoptions.go
48 lines (39 loc) · 840 Bytes
/
options.go
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
package easyshutdown
import (
"log"
"net/http"
"time"
opentrace "go.opentelemetry.io/otel/sdk/trace"
"google.golang.org/grpc"
)
type Option func(sd *Shutdown)
func WithShutdownTimeout(d time.Duration) Option {
return func(sd *Shutdown) {
sd.shutdownTimeout = d
}
}
func WithLogger(l *log.Logger) Option {
return func(sd *Shutdown) {
sd.logger = l
}
}
func WithHTTPServer(srv *http.Server) Option {
return func(sd *Shutdown) {
sd.services.httpServer = srv
}
}
func WithHTTPSServer(srv *http.Server) Option {
return func(sd *Shutdown) {
sd.services.httpsServer = srv
}
}
func WithGrpcServer(srv *grpc.Server) Option {
return func(sd *Shutdown) {
sd.services.grpcServer = srv
}
}
func WithTracerProvider(t *opentrace.TracerProvider) Option {
return func(sd *Shutdown) {
sd.services.tracerProvider = t
}
}