update micro

Signed-off-by: Vasiliy Tolstov <v.tolstov@unistack.org>
This commit is contained in:
2020-12-13 13:35:25 +03:00
parent b1e17ddc7e
commit d5e8eaee2f
3 changed files with 8 additions and 39 deletions

View File

@@ -6,13 +6,11 @@ import (
"errors"
"github.com/hashicorp/vault/api"
jsoncodec "github.com/unistack-org/micro-codec-json"
"github.com/unistack-org/micro/v3/config"
)
var (
DefaultStructTag = "vault"
ErrInvalidStruct = errors.New("invalid struct specified")
ErrPathNotExist = errors.New("path is not exist")
)
@@ -31,6 +29,10 @@ func (c *vaultConfig) Init(opts ...config.Option) error {
o(&c.opts)
}
if c.opts.Codec == nil {
return config.ErrCodecMissing
}
cfg := api.DefaultConfig()
path := ""
token := ""
@@ -127,7 +129,7 @@ func (c *vaultConfig) Save(ctx context.Context) error {
}
func (c *vaultConfig) String() string {
return "consul"
return "vault"
}
func NewConfig(opts ...config.Option) config.Config {
@@ -135,6 +137,5 @@ func NewConfig(opts ...config.Option) config.Config {
if len(options.StructTag) == 0 {
options.StructTag = DefaultStructTag
}
options.Codec = jsoncodec.NewCodec()
return &vaultConfig{opts: options}
}