From e25ad4f31b5d66cd325c4b3af359ab5ea8b441dc Mon Sep 17 00:00:00 2001 From: Vasiliy Tolstov Date: Mon, 15 Jan 2024 01:15:20 +0300 Subject: [PATCH] fixup conditions Signed-off-by: Vasiliy Tolstov --- consul.go | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/consul.go b/consul.go index 8ee4f88..41b3131 100644 --- a/consul.go +++ b/consul.go @@ -91,6 +91,10 @@ func (c *consulConfig) Init(opts ...options.Option) error { } func (c *consulConfig) Load(ctx context.Context, opts ...options.Option) error { + if c.opts.SkipLoad != nil && c.opts.SkipLoad(ctx, c) { + return nil + } + options := config.NewLoadOptions(opts...) if err := config.DefaultBeforeLoad(ctx, c); err != nil && !c.opts.AllowFail { @@ -153,6 +157,10 @@ func (c *consulConfig) Load(ctx context.Context, opts ...options.Option) error { } func (c *consulConfig) Save(ctx context.Context, opts ...options.Option) error { + if c.opts.SkipSave != nil && c.opts.SkipSave(ctx, c) { + return nil + } + options := config.NewSaveOptions(opts...) if err := config.DefaultBeforeSave(ctx, c); err != nil && !c.opts.AllowFail {