1
0
mirror of https://github.com/go-micro/go-micro.git synced 2024-12-18 08:26:38 +02:00
go-micro/api/options.go

26 lines
373 B
Go
Raw Normal View History

package api
2022-07-02 15:15:02 +02:00
import (
"go-micro.dev/v4/api/router"
)
func NewOptions(opts ...Option) Options {
options := Options{
Address: ":8080",
}
for _, o := range opts {
o(&options)
}
return options
}
2022-07-02 15:15:02 +02:00
// WithRouter sets the router to use e.g static or registry
func WithRouter(r router.Router) Option {
return func(o *Options) error {
o.Router = r
return nil
}
}