Appeler config.RegisterFlags dans rootCmd

This commit is contained in:
Victor Lacasse-Beaudoin 2023-09-15 16:15:07 -04:00
parent ac20221ca3
commit 2bdb22d956

View file

@ -5,8 +5,10 @@ package cmd
import (
"fmt"
"log"
"os"
"git.agecem.com/agecem/bottin-ag/config"
"github.com/spf13/cobra"
"github.com/spf13/viper"
)
@ -30,6 +32,10 @@ func init() {
cobra.OnInitialize(initConfig)
rootCmd.PersistentFlags().StringVar(&cfgFile, "config", "", "config file (default is $HOME/.bottin-ag.yaml)")
if err := config.RegisterFlags(rootCmd); err != nil {
log.Fatal(err)
}
}
// initConfig reads in config file and ENV variables if set.