mirror of
https://github.com/m1k1o/neko.git
synced 2025-08-03 16:59:12 +02:00
enable legacy supprot if at least one legacy config entry is found.
This commit is contained in:
parent
3ac462e197
commit
4eadf996ed
12 changed files with 152 additions and 8 deletions
|
@ -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())
|
||||
}
|
||||
|
|
|
@ -88,8 +88,8 @@ func (c *serve) Init(cmd *cobra.Command) error {
|
|||
return err
|
||||
}
|
||||
|
||||
// V2 configuration
|
||||
if viper.GetBool("legacy") {
|
||||
// legacy if explicitly enabled or if unspecified and legacy config is found
|
||||
if viper.GetBool("legacy") || !viper.IsSet("legacy") {
|
||||
if err := c.configs.Desktop.InitV2(cmd); err != nil {
|
||||
return err
|
||||
}
|
||||
|
@ -124,7 +124,8 @@ func (c *serve) PreRun(cmd *cobra.Command, args []string) {
|
|||
c.configs.Plugins.Set()
|
||||
c.configs.Server.Set()
|
||||
|
||||
if viper.GetBool("legacy") {
|
||||
// legacy if explicitly enabled or if unspecified and legacy config is found
|
||||
if viper.GetBool("legacy") || !viper.IsSet("legacy") {
|
||||
c.configs.Desktop.SetV2()
|
||||
c.configs.Capture.SetV2()
|
||||
c.configs.WebRTC.SetV2()
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue