From 0850d21ff3097d672fd00796493b8d552bf125cc Mon Sep 17 00:00:00 2001 From: Denis Kirillov Date: Thu, 14 Dec 2023 16:12:10 +0300 Subject: [PATCH] [#266] Move trimming namespaces name into fetch function Signed-off-by: Denis Kirillov --- cmd/s3-gw/app.go | 5 ----- cmd/s3-gw/app_settings.go | 4 ++++ 2 files changed, 4 insertions(+), 5 deletions(-) diff --git a/cmd/s3-gw/app.go b/cmd/s3-gw/app.go index 6f1a9bc1..ca4200f0 100644 --- a/cmd/s3-gw/app.go +++ b/cmd/s3-gw/app.go @@ -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() diff --git a/cmd/s3-gw/app_settings.go b/cmd/s3-gw/app_settings.go index 3715e049..86a091c2 100644 --- a/cmd/s3-gw/app_settings.go +++ b/cmd/s3-gw/app_settings.go @@ -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 }