mirror of
https://github.com/tendermint/tendermint.git
synced 2026-09-21 07:24:36 +00:00
allow multiple deprecation warnings
This commit is contained in:
@@ -53,9 +53,10 @@ func ParseConfig(cmd *cobra.Command) (*cfg.Config, error) {
|
|||||||
if err := conf.ValidateBasic(); err != nil {
|
if err := conf.ValidateBasic(); err != nil {
|
||||||
return nil, fmt.Errorf("error in config file: %v", err)
|
return nil, fmt.Errorf("error in config file: %v", err)
|
||||||
}
|
}
|
||||||
err = conf.CheckDeprecated()
|
if warnings := conf.CheckDeprecated(); len(warnings) > 0 {
|
||||||
if err != nil {
|
for _, warning := range warnings {
|
||||||
logger.Info("deprecated usage found in configuration file", "error", err)
|
logger.Info("deprecated usage found in configuration file", "usage", warning)
|
||||||
|
}
|
||||||
}
|
}
|
||||||
return conf, nil
|
return conf, nil
|
||||||
}
|
}
|
||||||
|
|||||||
+5
-4
@@ -151,14 +151,15 @@ func (cfg *Config) ValidateBasic() error {
|
|||||||
return nil
|
return nil
|
||||||
}
|
}
|
||||||
|
|
||||||
func (cfg *Config) CheckDeprecated() error {
|
func (cfg *Config) CheckDeprecated() []string {
|
||||||
|
var warnings []string
|
||||||
if cfg.DeprecatedFastSyncConfig != nil {
|
if cfg.DeprecatedFastSyncConfig != nil {
|
||||||
return errors.New("[fastsync] table detected. This section has been renamed to [blocksync]. The values in this deprecated section will be disregarded.")
|
warnings = append(warnings, "[fastsync] table detected. This section has been renamed to [blocksync]. The values in this deprecated section will be disregarded.")
|
||||||
}
|
}
|
||||||
if cfg.BaseConfig.DeprecatedFastSyncMode != nil {
|
if cfg.BaseConfig.DeprecatedFastSyncMode != nil {
|
||||||
return errors.New("fast_sync key detected. This key has been renamed to block_sync. The value of this deprecated key will be disregarded.")
|
warnings = append(warnings, "fast_sync key detected. This key has been renamed to block_sync. The value of this deprecated key will be disregarded.")
|
||||||
}
|
}
|
||||||
return nil
|
return warnings
|
||||||
}
|
}
|
||||||
|
|
||||||
//-----------------------------------------------------------------------------
|
//-----------------------------------------------------------------------------
|
||||||
|
|||||||
Reference in New Issue
Block a user