mirror of
https://github.com/project-zot/zot.git
synced 2026-06-17 12:58:02 +08:00
Report unknown keys when parsing configuration files
Report missing mandatory ldap keys Signed-off-by: Petu Eusebiu <peusebiu@cisco.com>
This commit is contained in:
committed by
Ramkumar Chinchani
parent
20a60cbad4
commit
7c3a8f9d07
@@ -7,9 +7,7 @@ import (
|
||||
"github.com/getlantern/deepcopy"
|
||||
distspec "github.com/opencontainers/distribution-spec/specs-go"
|
||||
"github.com/spf13/viper"
|
||||
"zotregistry.io/zot/errors"
|
||||
extconf "zotregistry.io/zot/pkg/extensions/config"
|
||||
"zotregistry.io/zot/pkg/log"
|
||||
"zotregistry.io/zot/pkg/storage"
|
||||
)
|
||||
|
||||
@@ -167,20 +165,6 @@ func (c *Config) Sanitize() *Config {
|
||||
return sanitizedConfig
|
||||
}
|
||||
|
||||
func (c *Config) Validate(log log.Logger) error {
|
||||
// LDAP configuration
|
||||
if c.HTTP.Auth != nil && c.HTTP.Auth.LDAP != nil {
|
||||
l := c.HTTP.Auth.LDAP
|
||||
if l.UserAttribute == "" {
|
||||
log.Error().Str("userAttribute", l.UserAttribute).Msg("invalid LDAP configuration")
|
||||
|
||||
return errors.ErrLDAPConfig
|
||||
}
|
||||
}
|
||||
|
||||
return nil
|
||||
}
|
||||
|
||||
// LoadAccessControlConfig populates config.AccessControl struct with values from config.
|
||||
func (c *Config) LoadAccessControlConfig(viperInstance *viper.Viper) error {
|
||||
if c.HTTP.RawAccessControl == nil {
|
||||
|
||||
Reference in New Issue
Block a user