fixup opts

Signed-off-by: Vasiliy Tolstov <v.tolstov@unistack.org>
This commit is contained in:
Василий Толстов 2020-09-10 00:25:33 +03:00
parent 8f03480ed2
commit 9ea3149b60

View File

@ -51,8 +51,8 @@ type Options struct {
Context context.Context
}
func NewOptions() Options {
return Options{
func NewOptions(opts ...Option) Options {
options := Options{
Auth: auth.DefaultAuth,
Codecs: make(map[string]codec.NewCodec),
Context: context.Background(),
@ -66,7 +66,14 @@ func NewOptions() Options {
Name: DefaultName,
Version: DefaultVersion,
Id: DefaultId,
Transport: transport.DefaultTransport,
}
for _, o := range opts {
o(&options)
}
return options
}
// Server name