initial commit
This commit is contained in:
27
internal/routes/options.go
Normal file
27
internal/routes/options.go
Normal file
@@ -0,0 +1,27 @@
|
||||
package routes
|
||||
|
||||
import (
|
||||
"go.equinixmetal.net/infra9-metal-bridge/internal/service"
|
||||
"go.uber.org/zap"
|
||||
)
|
||||
|
||||
// Option is a functional configuration option for the router.
|
||||
type Option func(r *Router) error
|
||||
|
||||
// WithLogger sets the logger for the router.
|
||||
func WithLogger(logger *zap.Logger) Option {
|
||||
return func(r *Router) error {
|
||||
r.logger = logger
|
||||
|
||||
return nil
|
||||
}
|
||||
}
|
||||
|
||||
// WithService sets the service handler.
|
||||
func WithService(svc service.Service) Option {
|
||||
return func(r *Router) error {
|
||||
r.svc = svc
|
||||
|
||||
return nil
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user