Vault-4279 reporting redundant/unused keys in config (#14752)
* Vault-4279 reporting redundant/unused keys in config * missing validate step * CL * Change the log level
This commit is contained in:
parent
aafb5d6427
commit
8f6a97b81b
|
@ -0,0 +1,3 @@
|
|||
```release-note:bug
|
||||
core: report unused or redundant keys in server configuration
|
||||
```
|
|
@ -428,7 +428,7 @@ func (c *ServerCommand) parseConfig() (*server.Config, []configutil.ConfigError,
|
|||
}
|
||||
|
||||
func (c *ServerCommand) runRecoveryMode() int {
|
||||
config, _, err := c.parseConfig()
|
||||
config, configErrors, err := c.parseConfig()
|
||||
if err != nil {
|
||||
c.UI.Error(err.Error())
|
||||
return 1
|
||||
|
@ -458,6 +458,11 @@ func (c *ServerCommand) runRecoveryMode() int {
|
|||
JSONFormat: logFormat == logging.JSONFormat,
|
||||
})
|
||||
|
||||
// reporting Errors found in the config
|
||||
for _, cErr := range configErrors {
|
||||
c.logger.Warn(cErr.String())
|
||||
}
|
||||
|
||||
// Ensure logging is flushed if initialization fails
|
||||
defer c.flushLog()
|
||||
|
||||
|
@ -1071,7 +1076,7 @@ func (c *ServerCommand) Run(args []string) int {
|
|||
config.Listeners[0].Telemetry.UnauthenticatedMetricsAccess = true
|
||||
}
|
||||
|
||||
parsedConfig, _, err := c.parseConfig()
|
||||
parsedConfig, configErrors, err := c.parseConfig()
|
||||
if err != nil {
|
||||
c.UI.Error(err.Error())
|
||||
return 1
|
||||
|
@ -1116,6 +1121,11 @@ func (c *ServerCommand) Run(args []string) int {
|
|||
})
|
||||
}
|
||||
|
||||
// reporting Errors found in the config
|
||||
for _, cErr := range configErrors {
|
||||
c.logger.Warn(cErr.String())
|
||||
}
|
||||
|
||||
// Ensure logging is flushed if initialization fails
|
||||
defer c.flushLog()
|
||||
|
||||
|
@ -1539,6 +1549,7 @@ func (c *ServerCommand) Run(args []string) int {
|
|||
// Check for new log level
|
||||
var config *server.Config
|
||||
var level hclog.Level
|
||||
var configErrors []configutil.ConfigError
|
||||
for _, path := range c.flagConfigs {
|
||||
current, err := server.LoadConfig(path)
|
||||
if err != nil {
|
||||
|
@ -1546,6 +1557,8 @@ func (c *ServerCommand) Run(args []string) int {
|
|||
goto RUNRELOADFUNCS
|
||||
}
|
||||
|
||||
configErrors = append(configErrors, current.Validate(path)...)
|
||||
|
||||
if config == nil {
|
||||
config = current
|
||||
} else {
|
||||
|
@ -1559,6 +1572,11 @@ func (c *ServerCommand) Run(args []string) int {
|
|||
goto RUNRELOADFUNCS
|
||||
}
|
||||
|
||||
// reporting Errors found in the config
|
||||
for _, cErr := range configErrors {
|
||||
c.logger.Warn(cErr.String())
|
||||
}
|
||||
|
||||
core.SetConfig(config)
|
||||
|
||||
// reloading custom response headers to make sure we have
|
||||
|
|
Loading…
Reference in New Issue