fixup error

Signed-off-by: Vasiliy Tolstov <v.tolstov@unistack.org>
This commit is contained in:
Василий Толстов 2021-03-05 17:02:17 +03:00
parent fbdb6e332b
commit cb81c3f768

View File

@ -70,6 +70,8 @@ func (c *vaultConfig) Init(opts ...config.Option) error {
cli, err := api.NewClient(cfg) cli, err := api.NewClient(cfg)
if err != nil && !c.opts.AllowFail { if err != nil && !c.opts.AllowFail {
return nil
} else if err != nil {
return err return err
} }
@ -99,6 +101,12 @@ func (c *vaultConfig) Load(ctx context.Context) error {
} }
} }
if c.cli == nil && !c.opts.AllowFail {
return ErrPathNotExist
} else if c.cli == nil && c.opts.AllowFail {
return nil
}
pair, err := c.cli.Logical().Read(c.path) pair, err := c.cli.Logical().Read(c.path)
if err != nil && !c.opts.AllowFail { if err != nil && !c.opts.AllowFail {
return err return err