Vasiliy Tolstov
5c24db71f5
Some checks failed
dependabot-automerge / automerge (pull_request) Has been skipped
autoapprove / autoapprove (pull_request) Failing after 4s
automerge / automerge (pull_request) Failing after 4s
codeql / analyze (go) (pull_request) Failing after 5s
prbuild / test (pull_request) Failing after 5s
prbuild / lint (pull_request) Failing after 4s
Signed-off-by: Vasiliy Tolstov <v.tolstov@unistack.org>
59 lines
1.1 KiB
Go
59 lines
1.1 KiB
Go
package consul
|
|
|
|
import (
|
|
"time"
|
|
|
|
"github.com/hashicorp/consul/api"
|
|
"go.unistack.org/micro/v4/config"
|
|
)
|
|
|
|
type configKey struct{}
|
|
|
|
func Config(cfg *api.Config) config.Option {
|
|
return config.SetOption(configKey{}, cfg)
|
|
}
|
|
|
|
type tokenKey struct{}
|
|
|
|
func Token(token string) config.Option {
|
|
return config.SetOption(tokenKey{}, token)
|
|
}
|
|
|
|
type addrKey struct{}
|
|
|
|
func Address(addr string) config.Option {
|
|
return config.SetOption(addrKey{}, addr)
|
|
}
|
|
|
|
type pathKey struct{}
|
|
|
|
func Path(path string) config.Option {
|
|
return config.SetOption(pathKey{}, path)
|
|
}
|
|
|
|
/*
|
|
type tlsConfigKey struct{}
|
|
|
|
func TLSConfig(t *tls.Config) config.Option {
|
|
return config.SetOption(tlsConfigKey{}, t)
|
|
}
|
|
*/
|
|
|
|
type timeoutKey struct{}
|
|
|
|
func Timeout(td time.Duration) config.Option {
|
|
return config.SetOption(timeoutKey{}, td)
|
|
}
|
|
|
|
func LoadPath(path string) config.LoadOption {
|
|
return config.SetLoadOption(pathKey{}, path)
|
|
}
|
|
|
|
func SavePath(path string) config.SaveOption {
|
|
return config.SetSaveOption(pathKey{}, path)
|
|
}
|
|
|
|
func WatchPath(path string) config.WatchOption {
|
|
return config.SetWatchOption(pathKey{}, path)
|
|
}
|