From fe467c50d2c0356c37c6c29a8dc76628b29957a9 Mon Sep 17 00:00:00 2001 From: jay-dee7 Date: Thu, 21 Dec 2023 15:38:39 +0530 Subject: [PATCH] fix: Skip Mock DFS config parsing if not set Signed-off-by: jay-dee7 --- config/yaml.go | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/config/yaml.go b/config/yaml.go index ff5d5bb5..6fafc46c 100644 --- a/config/yaml.go +++ b/config/yaml.go @@ -150,6 +150,16 @@ func setDefaultsForDatabaseStore(cfg *OpenRegistryConfig) { } func parseAndSetMockStorageDriverOptions(cfg *OpenRegistryConfig) { + mockConfig := viper.GetStringMap("dfs.mock") + keys := make([]string, 0, len(mockConfig)) + for k := range mockConfig { + keys = append(keys, k) + } + + // skip is mock config is absent + if len(keys) == 0 { + return + } mockDFSType := viper.GetString("dfs.mock.type") if mockDFSType == "MemMapped" { viper.Set("dfs.mock.type", MockStorageBackendMemMapped)