From f28468a59c20c85bae445f376b2b2b7d430ae0cc Mon Sep 17 00:00:00 2001 From: Morya Date: Mon, 18 Dec 2023 18:29:47 +0800 Subject: [PATCH] feat: allow to set API listen address (#2680) --- api/options.go | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/api/options.go b/api/options.go index edf71476..3a1eeeb1 100644 --- a/api/options.go +++ b/api/options.go @@ -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 } } +