mirror of
https://github.com/project-zot/zot.git
synced 2026-06-16 20:38:08 +08:00
add enable/disable option for scrub extension (#827)
Signed-off-by: Andreea-Lupu <andreealupu1470@yahoo.com>
This commit is contained in:
@@ -39,5 +39,6 @@ type PrometheusConfig struct {
|
||||
}
|
||||
|
||||
type ScrubConfig struct {
|
||||
Enable *bool
|
||||
Interval time.Duration
|
||||
}
|
||||
|
||||
@@ -20,7 +20,7 @@ func EnableScrubExtension(config *config.Config, log log.Logger, storeController
|
||||
sch *scheduler.Scheduler,
|
||||
) {
|
||||
if config.Extensions.Scrub != nil &&
|
||||
config.Extensions.Scrub.Interval != 0 {
|
||||
*config.Extensions.Scrub.Enable {
|
||||
minScrubInterval, _ := time.ParseDuration("2h")
|
||||
|
||||
if config.Extensions.Scrub.Interval < minScrubInterval {
|
||||
|
||||
@@ -48,7 +48,9 @@ func TestScrubExtension(t *testing.T) {
|
||||
substore := config.StorageConfig{RootDirectory: subdir}
|
||||
conf.Storage.SubPaths = map[string]config.StorageConfig{"/a": substore}
|
||||
conf.Log.Output = logFile.Name()
|
||||
trueValue := true
|
||||
scrubConfig := &extconf.ScrubConfig{
|
||||
Enable: &trueValue,
|
||||
Interval: 2,
|
||||
}
|
||||
conf.Extensions = &extconf.ExtensionConfig{
|
||||
@@ -106,7 +108,9 @@ func TestScrubExtension(t *testing.T) {
|
||||
|
||||
conf.Storage.RootDirectory = dir
|
||||
conf.Log.Output = logFile.Name()
|
||||
trueValue := true
|
||||
scrubConfig := &extconf.ScrubConfig{
|
||||
Enable: &trueValue,
|
||||
Interval: 2,
|
||||
}
|
||||
conf.Extensions = &extconf.ExtensionConfig{
|
||||
@@ -171,7 +175,9 @@ func TestScrubExtension(t *testing.T) {
|
||||
|
||||
conf.Storage.RootDirectory = dir
|
||||
conf.Log.Output = logFile.Name()
|
||||
trueValue := true
|
||||
scrubConfig := &extconf.ScrubConfig{
|
||||
Enable: &trueValue,
|
||||
Interval: 2,
|
||||
}
|
||||
conf.Extensions = &extconf.ExtensionConfig{
|
||||
|
||||
Reference in New Issue
Block a user