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

feat: allow to set API listen address (#2680)

This commit is contained in:
Morya 2023-12-18 18:29:47 +08:00 committed by GitHub
parent 3a4790b3c5
commit f28468a59c
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -19,6 +19,14 @@ func NewOptions(opts ...Option) Options {
return options
}
// WithAddress sets the address to listen
func WithAddress(addr string) Option {
return func(o *Options) error {
o.Address = addr
return nil
}
}
// WithRouter sets the router to use e.g static or registry.
func WithRouter(r router.Router) Option {
return func(o *Options) error {
@ -35,3 +43,4 @@ func WithRegistry(r registry.Registry) Option {
return nil
}
}