micro-config-consul/options.go
Vasiliy Tolstov bc16cf50a7
Some checks failed
autoapprove / autoapprove (pull_request) Failing after 1m26s
automerge / automerge (pull_request) Failing after 3s
codeql / analyze (go) (pull_request) Failing after 3m12s
dependabot-automerge / automerge (pull_request) Has been skipped
prbuild / test (pull_request) Failing after 1m30s
prbuild / lint (pull_request) Failing after 2m41s
update for latest micro changes
Signed-off-by: Vasiliy Tolstov <v.tolstov@unistack.org>
2023-08-14 23:36:40 +03:00

47 lines
834 B
Go

package consul
import (
"time"
"github.com/hashicorp/consul/api"
"go.unistack.org/micro/v4/options"
)
type configKey struct{}
func Config(cfg *api.Config) options.Option {
return options.ContextOption(configKey{}, cfg)
}
type tokenKey struct{}
func Token(token string) options.Option {
return options.ContextOption(tokenKey{}, token)
}
type addrKey struct{}
func Address(addr string) options.Option {
return options.ContextOption(addrKey{}, addr)
}
type pathKey struct{}
func Path(path string) options.Option {
return options.ContextOption(pathKey{}, path)
}
type timeoutKey struct{}
func Timeout(td time.Duration) options.Option {
return options.ContextOption(timeoutKey{}, td)
}
/*
type tlsConfigKey struct{}
func TLSConfig(t *tls.Config) options.Option {
return options.ContextOption(tlsConfigKey{}, t)
}
*/