mirror of
https://github.com/project-zot/zot.git
synced 2026-06-16 04:17:55 +08:00
sync: make RetryDelay and MaxRetries optional
Signed-off-by: Petu Eusebiu <peusebiu@cisco.com>
This commit is contained in:
committed by
Ramkumar Chinchani
parent
37d150e32f
commit
0ec39c0313
+4
-4
@@ -246,11 +246,11 @@ func validateConfiguration(config *config.Config) {
|
||||
|
||||
// check glob patterns in sync config are compilable
|
||||
if config.Extensions != nil && config.Extensions.Sync != nil {
|
||||
for _, regCfg := range config.Extensions.Sync.Registries {
|
||||
for id, regCfg := range config.Extensions.Sync.Registries {
|
||||
// check retry options are configured for sync
|
||||
if regCfg.MaxRetries == nil || regCfg.RetryDelay == nil {
|
||||
log.Error().Err(errors.ErrBadConfig).Msg("extensions.sync.registries[].MaxRetries" +
|
||||
"and extensions.sync.registries[].RetryDelay fields are mandatory")
|
||||
if regCfg.MaxRetries != nil && regCfg.RetryDelay == nil {
|
||||
log.Error().Err(errors.ErrBadConfig).Msgf("extensions.sync.registries[%d].retryDelay"+
|
||||
" is required when using extensions.sync.registries[%d].maxRetries", id, id)
|
||||
panic(errors.ErrBadConfig)
|
||||
}
|
||||
|
||||
|
||||
@@ -267,7 +267,7 @@ func TestVerify(t *testing.T) {
|
||||
"http":{"address":"127.0.0.1","port":"8080","realm":"zot",
|
||||
"auth":{"htpasswd":{"path":"test/data/htpasswd"},"failDelay":1}},
|
||||
"extensions":{"sync": {"registries": [{"urls":["localhost:9999"],
|
||||
"content": [{"prefix":"repo**"}]}]}}}`)
|
||||
"maxRetries": 10, "content": [{"prefix":"repo**"}]}]}}}`)
|
||||
_, err = tmpfile.Write(content)
|
||||
So(err, ShouldBeNil)
|
||||
err = tmpfile.Close()
|
||||
|
||||
Reference in New Issue
Block a user