[#493] Fix of receiving VHS namespaces map
In the process of forming a map with namespaces for which VHS is enabled, we resolve the alias of the namespace. The problem is that to resolve, we need default namespace names, which in turn do not have time to decide by this time. Therefore, now the check for the default name takes place directly in the prepareVHSNamespaces function based on previously read default names. Signed-off-by: Roman Loginov <r.loginov@yadro.com>
This commit is contained in:
parent
a87c636b4c
commit
8ca73e2079
1 changed files with 6 additions and 3 deletions
|
@ -239,6 +239,7 @@ func newAppSettings(log *Logger, v *viper.Viper) *appSettings {
|
|||
func (s *appSettings) update(v *viper.Viper, log *zap.Logger) {
|
||||
namespaceHeader := v.GetString(cfgResolveNamespaceHeader)
|
||||
nsConfig, defaultNamespaces := fetchNamespacesConfig(log, v)
|
||||
vhsNamespacesEnabled := s.prepareVHSNamespaces(v, log, defaultNamespaces)
|
||||
defaultXMLNS := v.GetBool(cfgKludgeUseDefaultXMLNS)
|
||||
bypassContentEncodingInChunks := v.GetBool(cfgKludgeBypassContentEncodingCheckInChunks)
|
||||
clientCut := v.GetBool(cfgClientCut)
|
||||
|
@ -253,7 +254,6 @@ func (s *appSettings) update(v *viper.Viper, log *zap.Logger) {
|
|||
vhsEnabled := v.GetBool(cfgVHSEnabled)
|
||||
vhsHeader := v.GetString(cfgVHSHeader)
|
||||
servernameHeader := v.GetString(cfgServernameHeader)
|
||||
vhsNamespacesEnabled := s.prepareVHSNamespaces(v, log)
|
||||
httpLoggingEnabled := v.GetBool(cfgHTTPLoggingEnabled)
|
||||
httpLoggingMaxBody := v.GetInt64(cfgHTTPLoggingMaxBody)
|
||||
httpLoggingMaxLogSize := v.GetInt(cfgHTTPLoggingMaxLogSize)
|
||||
|
@ -290,11 +290,14 @@ func (s *appSettings) update(v *viper.Viper, log *zap.Logger) {
|
|||
s.vhsNamespacesEnabled = vhsNamespacesEnabled
|
||||
}
|
||||
|
||||
func (s *appSettings) prepareVHSNamespaces(v *viper.Viper, log *zap.Logger) map[string]bool {
|
||||
func (s *appSettings) prepareVHSNamespaces(v *viper.Viper, log *zap.Logger, defaultNamespaces []string) map[string]bool {
|
||||
nsMap := fetchVHSNamespaces(v, log)
|
||||
vhsNamespaces := make(map[string]bool, len(nsMap))
|
||||
for ns, flag := range nsMap {
|
||||
vhsNamespaces[s.ResolveNamespaceAlias(ns)] = flag
|
||||
if slices.Contains(defaultNamespaces, ns) {
|
||||
ns = defaultNamespace
|
||||
}
|
||||
vhsNamespaces[ns] = flag
|
||||
}
|
||||
|
||||
return vhsNamespaces
|
||||
|
|
Loading…
Reference in a new issue