mirror of
https://github.com/foomo/keel.git
synced 2025-10-16 12:35:34 +00:00
40 lines
615 B
Go
40 lines
615 B
Go
package keeltest
|
|
|
|
import (
|
|
"context"
|
|
|
|
"github.com/spf13/viper"
|
|
"go.uber.org/zap"
|
|
)
|
|
|
|
// Option func
|
|
type Option func(inst *Server)
|
|
|
|
// WithLogger option
|
|
func WithLogger(l *zap.Logger) Option {
|
|
return func(inst *Server) {
|
|
inst.l = l
|
|
}
|
|
}
|
|
|
|
// WithLogFields option
|
|
func WithLogFields(fields ...zap.Field) Option {
|
|
return func(inst *Server) {
|
|
inst.l = inst.l.With(fields...)
|
|
}
|
|
}
|
|
|
|
// WithConfig option
|
|
func WithConfig(c *viper.Viper) Option {
|
|
return func(inst *Server) {
|
|
inst.c = c
|
|
}
|
|
}
|
|
|
|
// WithContext option
|
|
func WithContext(ctx context.Context) Option {
|
|
return func(inst *Server) {
|
|
inst.ctx = ctx
|
|
}
|
|
}
|