From 0f25bd51495138ecde5843df4efc1067c549f82c Mon Sep 17 00:00:00 2001 From: Mostafa Moradian Date: Thu, 12 Jan 2023 21:14:35 +0100 Subject: [PATCH 1/3] Default log-level is info --- cmd/run.go | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/cmd/run.go b/cmd/run.go index c89f4007..5f70e402 100644 --- a/cmd/run.go +++ b/cmd/run.go @@ -32,9 +32,10 @@ var ( hooksConfig = hook.NewHookConfig() DefaultLogger = logging.NewLogger( logging.LoggerConfig{ - Level: zerolog.DebugLevel, + Level: zerolog.InfoLevel, // Default log level NoColor: true, - }) + }, + ) pluginRegistry = plugin.NewRegistry(hooksConfig) // Global koanf instance. Using "." as the key path delimiter. globalConfig = koanf.New(".") From d7b51d6a4ecf76fdda047b3e27c358a21838dd39 Mon Sep 17 00:00:00 2001 From: Mostafa Moradian Date: Thu, 12 Jan 2023 21:37:05 +0100 Subject: [PATCH 2/3] Config args are not persistent (they are local to run command) --- cmd/run.go | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/cmd/run.go b/cmd/run.go index 5f70e402..f715a271 100644 --- a/cmd/run.go +++ b/cmd/run.go @@ -364,11 +364,11 @@ var runCmd = &cobra.Command{ func init() { rootCmd.AddCommand(runCmd) - runCmd.PersistentFlags().StringVarP( + runCmd.Flags().StringVarP( &globalConfigFile, "config", "c", "./gatewayd.yaml", "config file (default is ./gatewayd.yaml)") - runCmd.PersistentFlags().StringVarP( + runCmd.Flags().StringVarP( &pluginConfigFile, "plugin-config", "p", "./gatewayd_plugins.yaml", "plugin config file (default is ./gatewayd_plugins.yaml)") From 2493bef0532afd300400b618ed3bae18f2ccc256 Mon Sep 17 00:00:00 2001 From: Mostafa Moradian Date: Fri, 13 Jan 2023 00:20:10 +0100 Subject: [PATCH 3/3] Remove global variables --- cmd/run.go | 11 ++--------- 1 file changed, 2 insertions(+), 9 deletions(-) diff --git a/cmd/run.go b/cmd/run.go index f715a271..c8f230e9 100644 --- a/cmd/run.go +++ b/cmd/run.go @@ -23,11 +23,6 @@ import ( "github.com/spf13/cobra" ) -var ( - globalConfigFile string - pluginConfigFile string -) - var ( hooksConfig = hook.NewHookConfig() DefaultLogger = logging.NewLogger( @@ -364,12 +359,10 @@ var runCmd = &cobra.Command{ func init() { rootCmd.AddCommand(runCmd) - runCmd.Flags().StringVarP( - &globalConfigFile, + runCmd.Flags().StringP( "config", "c", "./gatewayd.yaml", "config file (default is ./gatewayd.yaml)") - runCmd.Flags().StringVarP( - &pluginConfigFile, + runCmd.Flags().StringP( "plugin-config", "p", "./gatewayd_plugins.yaml", "plugin config file (default is ./gatewayd_plugins.yaml)") }