fixup conditions
Some checks failed
build / test (push) Has been cancelled
build / lint (push) Has been cancelled
codeql / analyze (go) (push) Has been cancelled

Signed-off-by: Vasiliy Tolstov <v.tolstov@unistack.org>
This commit is contained in:
2024-01-15 02:00:34 +03:00
parent 7018485fde
commit f8f36b157f
3 changed files with 18 additions and 2 deletions

View File

@@ -54,6 +54,10 @@ func (c *fileConfig) Init(opts ...config.Option) error {
}
func (c *fileConfig) Load(ctx context.Context, opts ...config.LoadOption) error {
if c.opts.SkipLoad != nil && c.opts.SkipLoad(ctx, c) {
return nil
}
if err := config.DefaultBeforeLoad(ctx, c); err != nil && !c.opts.AllowFail {
return err
}
@@ -125,6 +129,10 @@ func (c *fileConfig) Load(ctx context.Context, opts ...config.LoadOption) error
}
func (c *fileConfig) Save(ctx context.Context, opts ...config.SaveOption) error {
if c.opts.SkipSave != nil && c.opts.SkipSave(ctx, c) {
return nil
}
if err := config.DefaultBeforeSave(ctx, c); err != nil && !c.opts.AllowFail {
return err
}