[#266] Move trimming namespaces name into fetch function

Signed-off-by: Denis Kirillov <d.kirillov@yadro.com>
This commit is contained in:
Denis Kirillov 2023-12-14 16:12:10 +03:00
parent 9272f4e108
commit 0850d21ff3
2 changed files with 4 additions and 5 deletions

View file

@ -12,7 +12,6 @@ import (
"os" "os"
"os/signal" "os/signal"
"runtime/debug" "runtime/debug"
"strings"
"sync" "sync"
"syscall" "syscall"
"time" "time"
@ -368,10 +367,6 @@ func (s *appSettings) IsDefaultNamespace(ns string) bool {
} }
func (s *appSettings) setDefaultNamespaces(namespaces []string) { func (s *appSettings) setDefaultNamespaces(namespaces []string) {
for i := range namespaces { // to be set namespaces in env variable as `S3_GW_KLUDGE_DEFAULT_NAMESPACES="" "root"`
namespaces[i] = strings.Trim(namespaces[i], "\"")
}
s.mu.Lock() s.mu.Lock()
s.defaultNamespaces = namespaces s.defaultNamespaces = namespaces
s.mu.Unlock() s.mu.Unlock()

View file

@ -481,6 +481,10 @@ func fetchDefaultNamespaces(l *zap.Logger, v *viper.Viper) []string {
l.Warn(logs.DefaultNamespacesCannotBeEmpty, zap.Strings("namespaces", defaultNamespaces)) l.Warn(logs.DefaultNamespacesCannotBeEmpty, zap.Strings("namespaces", defaultNamespaces))
} }
for i := range defaultNamespaces { // to be set namespaces in env variable as `S3_GW_KLUDGE_DEFAULT_NAMESPACES="" 'root'`
defaultNamespaces[i] = strings.Trim(defaultNamespaces[i], "\"'")
}
return defaultNamespaces return defaultNamespaces
} }