diff --git a/cmd/config.go b/cmd/config.go index 16dbf8e..339a690 100644 --- a/cmd/config.go +++ b/cmd/config.go @@ -1,4 +1,4 @@ -// Copyright © 2022 Kaleido, Inc. +// Copyright © 2023 Kaleido, Inc. // // SPDX-License-Identifier: Apache-2.0 // @@ -30,7 +30,7 @@ func configCommand() *cobra.Command { Short: "Prints the config info as markdown", Long: "", RunE: func(cmd *cobra.Command, args []string) error { - initConfig() + InitConfig() b, err := config.GenerateConfigMarkdown(context.Background(), "", config.GetKnownKeys()) fmt.Println(string(b)) return err diff --git a/cmd/config_docs_test.go b/cmd/config_docs_test.go index 812cfcd..5d24453 100644 --- a/cmd/config_docs_test.go +++ b/cmd/config_docs_test.go @@ -1,4 +1,4 @@ -// Copyright © 2022 Kaleido, Inc. +// Copyright © 2023 Kaleido, Inc. // // SPDX-License-Identifier: Apache-2.0 // @@ -32,7 +32,7 @@ import ( func TestConfigDocsUpToDate(t *testing.T) { // Initialize config of all plugins - initConfig() + InitConfig() generatedConfig, err := config.GenerateConfigMarkdown(context.Background(), "", config.GetKnownKeys()) assert.NoError(t, err) configOnDisk, err := os.ReadFile(filepath.Join("..", "config.md")) diff --git a/cmd/evmconnect.go b/cmd/evmconnect.go index add2e8f..3b3ba76 100644 --- a/cmd/evmconnect.go +++ b/cmd/evmconnect.go @@ -51,7 +51,7 @@ var cfgFile string var connectorConfig config.Section func init() { - rootCmd.PersistentFlags().StringVarP(&cfgFile, "config", "f", "", "config file") + rootCmd.Flags().StringVarP(&cfgFile, "config", "f", "", "config file") rootCmd.AddCommand(versionCommand()) rootCmd.AddCommand(configCommand()) rootCmd.AddCommand(fftmcmd.ClientCommand()) @@ -61,7 +61,7 @@ func Execute() error { return rootCmd.Execute() } -func initConfig() { +func InitConfig() { fftm.InitConfig() connectorConfig = config.RootSection("connector") ethereum.InitConfig(connectorConfig) @@ -70,7 +70,6 @@ func initConfig() { func run() error { - initConfig() err := config.ReadConfig("evmconnect", cfgFile) // Setup logging after reading config (even if failed), to output header correctly diff --git a/evmconnect/main.go b/evmconnect/main.go index 1f07855..701c372 100644 --- a/evmconnect/main.go +++ b/evmconnect/main.go @@ -1,4 +1,4 @@ -// Copyright © 2022 Kaleido, Inc. +// Copyright © 2023 Kaleido, Inc. // // SPDX-License-Identifier: Apache-2.0 // @@ -24,6 +24,7 @@ import ( ) func main() { + cmd.InitConfig() if err := cmd.Execute(); err != nil { fmt.Fprintf(os.Stderr, "%s\n", err) os.Exit(1)