Parse config overrides on cli

This commit is contained in:
Dan Jones 2024-02-09 09:44:35 -06:00
commit 25f5c37243
8 changed files with 169 additions and 32 deletions

View file

@ -23,8 +23,6 @@ import (
"github.com/spf13/cobra"
)
var cfgFile string
// rootCmd represents the base command when called without any subcommands
var rootCmd = &cobra.Command{
Use: "my-log",
@ -52,6 +50,7 @@ func init() {
// will be global for your application.
rootCmd.PersistentFlags().StringVarP(&config.ConfigPath, "config", "c", config.ConfigPath, "config file")
rootCmd.PersistentFlags().StringToStringVarP(&config.Overrides, "config-value", "v", config.Overrides, "Override config values. Use dot syntax to specify key. E.g. -v output.stdout.config.json=true")
// Cobra also supports local flags, which will only run
// when this action is called directly.
@ -61,4 +60,5 @@ func init() {
// initConfig reads in config file and ENV variables if set.
func initConfig() {
// @todo
}