use codec to unmarshal

Signed-off-by: Vasiliy Tolstov <v.tolstov@unistack.org>
This commit is contained in:
Василий Толстов 2020-12-11 02:12:36 +03:00
parent 4c529af53f
commit bdc6232ea9

View File

@ -2,7 +2,6 @@ package consul
import ( import (
"context" "context"
"encoding/json"
"errors" "errors"
"github.com/hashicorp/consul/api" "github.com/hashicorp/consul/api"
@ -85,7 +84,7 @@ func (c *consulConfig) Load(ctx context.Context) error {
return ErrPathNotExist return ErrPathNotExist
} }
return json.Unmarshal(pair.Value, c.opts.Struct) return c.opts.Codec.Unmarshal(pair.Value, c.opts.Struct)
} }
func (c *consulConfig) Save(ctx context.Context) error { func (c *consulConfig) Save(ctx context.Context) error {