[#266] Move trimming namespaces name into fetch function

Signed-off-by: Denis Kirillov <d.kirillov@yadro.com>
pull/281/head
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/signal"
"runtime/debug"
"strings"
"sync"
"syscall"
"time"
@ -368,10 +367,6 @@ func (s *appSettings) IsDefaultNamespace(ns string) bool {
}
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.defaultNamespaces = namespaces
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))
}
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
}