mirror of
https://github.com/project-zot/zot.git
synced 2026-06-17 12:58:02 +08:00
fix: sync should be disabled when enable is false (#3579)
Signed-off-by: Matthieu Mottet <m.mottet@outlook.com>
This commit is contained in:
@@ -126,7 +126,8 @@ func (e *ExtensionConfig) IsSyncEnabled() bool {
|
||||
// 1. Explicitly enabled (Enable == true), OR
|
||||
// 2. There are registries configured (enabled by default when registries exist)
|
||||
// This matches the behavior in root.go where Sync.Enable defaults to true when registries are present
|
||||
return e.Sync != nil && ((e.Sync.Enable != nil && *e.Sync.Enable) || len(e.Sync.Registries) > 0)
|
||||
return e.Sync != nil && ((e.Sync.Enable != nil && *e.Sync.Enable) ||
|
||||
(e.Sync.Enable == nil && len(e.Sync.Registries) > 0))
|
||||
}
|
||||
|
||||
// IsScrubEnabled checks if scrub is enabled in this extensions config.
|
||||
|
||||
@@ -57,6 +57,11 @@ func buildSyncConfig(enabled bool) *config.ExtensionConfig {
|
||||
ext := &config.ExtensionConfig{}
|
||||
ext.Sync = &sync.Config{
|
||||
Enable: &enabled,
|
||||
Registries: []sync.RegistryConfig{
|
||||
{
|
||||
URLs: []string{"localhost"},
|
||||
},
|
||||
},
|
||||
}
|
||||
|
||||
return ext
|
||||
|
||||
Reference in New Issue
Block a user