diff --git a/file.go b/file.go index 530b08f..7b1db0d 100644 --- a/file.go +++ b/file.go @@ -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 } diff --git a/go.mod b/go.mod index 36c38ee..3ec0500 100644 --- a/go.mod +++ b/go.mod @@ -3,6 +3,8 @@ module go.unistack.org/micro-config-file/v3 go 1.18 require ( - github.com/imdario/mergo v0.3.13 - go.unistack.org/micro/v3 v3.10.16 + github.com/imdario/mergo v0.3.16 + go.unistack.org/micro/v3 v3.10.36 ) + +require github.com/google/uuid v1.5.0 // indirect diff --git a/go.sum b/go.sum index 8ff5437..9a5e3af 100644 --- a/go.sum +++ b/go.sum @@ -1,9 +1,15 @@ +github.com/google/uuid v1.5.0 h1:1p67kYwdtXjb0gL0BPiP1Av9wiZPo5A8z2cWkTZ+eyU= +github.com/google/uuid v1.5.0/go.mod h1:TIyPZe4MgqvfeYDBFedMoGGpEw/LqOeaOT+nhxU+yHo= github.com/imdario/mergo v0.3.13 h1:lFzP57bqS/wsqKssCGmtLAb8A0wKjLGrve2q3PPVcBk= github.com/imdario/mergo v0.3.13/go.mod h1:4lJ1jqUDcsbIECGy0RUJAXNIhg+6ocWgb1ALK2O4oXg= +github.com/imdario/mergo v0.3.16 h1:wwQJbIsHYGMUyLSPrEq1CT16AhnhNJQ51+4fdHUnCl4= +github.com/imdario/mergo v0.3.16/go.mod h1:WBLT9ZmE3lPoWsEzCh9LPo3TiwVN+ZKEjmz+hD27ysY= github.com/patrickmn/go-cache v2.1.0+incompatible/go.mod h1:3Qf8kWWT7OJRJbdiICTKqZju1ZixQ/KpMGzzAfe6+WQ= github.com/silas/dag v0.0.0-20211117232152-9d50aa809f35/go.mod h1:7RTUFBdIRC9nZ7/3RyRNH1bdqIShrDejd1YbLwgPS+I= go.unistack.org/micro/v3 v3.10.16 h1:2er/SKKYbV60M+UuJM4eYCF0MZYAIq/yNUrAbTfgq8Q= go.unistack.org/micro/v3 v3.10.16/go.mod h1:uMAc0U/x7dmtICCrblGf0ZLgYegu3VwQAquu+OFCw1Q= +go.unistack.org/micro/v3 v3.10.36 h1:+XPhpguDC0HldSePp5TODdMJ06+IUy1AQkYN7ub84DA= +go.unistack.org/micro/v3 v3.10.36/go.mod h1:eUgtvbtiiz6te93m0ZdmoecbitWwjdBmmr84srmEIKA= gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0= gopkg.in/yaml.v3 v3.0.0/go.mod h1:K4uyk7z7BCEPqu6E+C64Yfv1cQ7kz7rIZviUmN+EgEM= gopkg.in/yaml.v3 v3.0.1 h1:fxVm/GzAzEWqLHuvctI91KS9hhNmmWOoWu0XTYJS7CA=