initial import

Signed-off-by: Vasiliy Tolstov <v.tolstov@unistack.org>
This commit is contained in:
2020-12-08 00:58:12 +03:00
parent a1137eafcd
commit 5912af307d
5 changed files with 650 additions and 12 deletions

30
options.go Normal file
View File

@@ -0,0 +1,30 @@
package consul
import (
"github.com/hashicorp/consul/api"
"github.com/unistack-org/micro/v3/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)
}