enable legacy supprot if at least one legacy config entry is found.

This commit is contained in:
Miroslav Šedivý 2025-02-20 20:10:07 +01:00
parent 3ac462e197
commit 4eadf996ed
12 changed files with 152 additions and 8 deletions

View file

@ -81,6 +81,11 @@ func init() {
// set root config values
rootConfig.Set()
// legacy if explicitly enabled or if unspecified and legacy config is found
if viper.GetBool("legacy") || !viper.IsSet("legacy") {
rootConfig.SetV2()
}
//////
// logs
//////
@ -161,5 +166,12 @@ func init() {
log.Panic().Err(err).Msg("unable to run root command")
}
// legacy if explicitly enabled or if unspecified and legacy config is found
if viper.GetBool("legacy") || !viper.IsSet("legacy") {
if err := rootConfig.InitV2(root); err != nil {
log.Panic().Err(err).Msg("unable to run root command")
}
}
root.SetVersionTemplate(neko.Version.Details())
}