mirror of
https://github.com/project-zot/zot.git
synced 2026-06-16 04:17:55 +08:00
add enable/disable option for scrub extension (#827)
Signed-off-by: Andreea-Lupu <andreealupu1470@yahoo.com>
This commit is contained in:
@@ -344,6 +344,13 @@ func applyDefaultValues(config *config.Config, viperInstance *viper.Viper) {
|
||||
// Note: In case search is not empty the config.Extensions will not be nil and we will not reach here
|
||||
config.Extensions.Search = &extconf.SearchConfig{}
|
||||
}
|
||||
|
||||
_, ok = extMap["scrub"]
|
||||
if ok {
|
||||
// we found a config like `"extensions": {"scrub:": {}}`
|
||||
// Note: In case scrub is not empty the config.Extensions will not be nil and we will not reach here
|
||||
config.Extensions.Scrub = &extconf.ScrubConfig{}
|
||||
}
|
||||
}
|
||||
|
||||
if config.Extensions != nil {
|
||||
@@ -378,6 +385,16 @@ func applyDefaultValues(config *config.Config, viperInstance *viper.Viper) {
|
||||
config.Extensions.Metrics.Prometheus = &extconf.PrometheusConfig{Path: constants.DefaultMetricsExtensionRoute}
|
||||
}
|
||||
}
|
||||
|
||||
if config.Extensions.Scrub != nil {
|
||||
if config.Extensions.Scrub.Enable == nil {
|
||||
config.Extensions.Scrub.Enable = &defaultVal
|
||||
}
|
||||
|
||||
if config.Extensions.Scrub.Interval == 0 {
|
||||
config.Extensions.Scrub.Interval = 24 * time.Hour // nolint: gomnd
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if !config.Storage.GC && viperInstance.Get("storage::gcdelay") == nil {
|
||||
|
||||
Reference in New Issue
Block a user