mirror of
https://github.com/project-zot/zot.git
synced 2026-06-15 20:07:55 +08:00
Update dist-spec version automatically
Warning if config has wrong dist-spec version Signed-off-by: laurentiuNiculae <themelopeus@gmail.com>
This commit is contained in:
committed by
Ramkumar Chinchani
parent
fa27e22404
commit
63d94d4ac5
@@ -363,6 +363,23 @@ func applyDefaultValues(config *config.Config, viperInstance *viper.Viper) {
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if config.DistSpecVersion != distspec.Version {
|
||||
log.Warn().Err(errors.ErrBadConfig).
|
||||
Msgf("config dist-spec version: %s differs from version actually used: %s, will be corrected automatically",
|
||||
config.DistSpecVersion, distspec.Version)
|
||||
|
||||
// rewrite the config file
|
||||
viperInstance.Set("distSpecVersion", distspec.Version)
|
||||
|
||||
err := viperInstance.WriteConfig()
|
||||
if err != nil {
|
||||
log.Warn().Err(errors.ErrBadConfig).
|
||||
Msg("can't rewrite the config file")
|
||||
}
|
||||
|
||||
config.DistSpecVersion = distspec.Version
|
||||
}
|
||||
}
|
||||
|
||||
func LoadConfiguration(config *config.Config, configPath string) {
|
||||
|
||||
Reference in New Issue
Block a user