From 55e5e5a2f28a8847e0003054ca70e905eca00af7 Mon Sep 17 00:00:00 2001 From: Peter Broadhurst Date: Thu, 23 Mar 2023 10:07:52 +0000 Subject: [PATCH 1/3] Only require the -f parameter on the root command Signed-off-by: Peter Broadhurst --- cmd/evmconnect.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/cmd/evmconnect.go b/cmd/evmconnect.go index add2e8f..1ff1bfa 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()) From 90de5ff642afbf2a32b5e6a1b3fe12d489f53641 Mon Sep 17 00:00:00 2001 From: Peter Broadhurst Date: Thu, 23 Mar 2023 10:18:27 +0000 Subject: [PATCH 2/3] Expose InitConfig separate to run Signed-off-by: Peter Broadhurst --- cmd/config.go | 4 ++-- cmd/config_docs_test.go | 4 ++-- cmd/evmconnect.go | 3 +-- evmconnect/main.go | 3 ++- 4 files changed, 7 insertions(+), 7 deletions(-) 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 1ff1bfa..3b3ba76 100644 --- a/cmd/evmconnect.go +++ b/cmd/evmconnect.go @@ -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) From de8705ff75dfd9871d425f8a794eba4181aa36c9 Mon Sep 17 00:00:00 2001 From: Peter Broadhurst Date: Thu, 23 Mar 2023 10:42:10 +0000 Subject: [PATCH 3/3] Update FFTM to v1.2.8 Signed-off-by: Peter Broadhurst --- go.mod | 4 ++-- go.sum | 4 ++++ 2 files changed, 6 insertions(+), 2 deletions(-) diff --git a/go.mod b/go.mod index 2ddcb1d..a110f91 100644 --- a/go.mod +++ b/go.mod @@ -4,9 +4,9 @@ go 1.19 require ( github.com/hashicorp/golang-lru v0.5.4 - github.com/hyperledger/firefly-common v1.2.1 + github.com/hyperledger/firefly-common v1.2.7 github.com/hyperledger/firefly-signer v1.1.4 - github.com/hyperledger/firefly-transaction-manager v1.2.6 + github.com/hyperledger/firefly-transaction-manager v1.2.8 github.com/sirupsen/logrus v1.9.0 github.com/spf13/cobra v1.6.1 github.com/stretchr/testify v1.8.1 diff --git a/go.sum b/go.sum index 3eb1d3b..27bc466 100644 --- a/go.sum +++ b/go.sum @@ -196,10 +196,14 @@ github.com/huandu/xstrings v1.3.1 h1:4jgBlKK6tLKFvO8u5pmYjG91cqytmDCDvGh7ECVFfFs github.com/huandu/xstrings v1.3.1/go.mod h1:y5/lhBue+AyNmUVz9RLU9xbLR0o4KIIExikq4ovT0aE= github.com/hyperledger/firefly-common v1.2.1 h1:h35T5Ask/ixlW70KZxHpPsO5QfdnKBFEyX+7L10lwoo= github.com/hyperledger/firefly-common v1.2.1/go.mod h1:aqaq2ZUzSlkwVC/TF+pwUkHxGDLYSE2DzdozZ1MIMeM= +github.com/hyperledger/firefly-common v1.2.7 h1:voFbNVRFHZ64EJbyxCtMbLLriNRyqrl+wdUEqpgexHs= +github.com/hyperledger/firefly-common v1.2.7/go.mod h1:uYO8DMgT3OGoF2R4Bew1Ql4BS3udYGzPs59sJH1V3E4= github.com/hyperledger/firefly-signer v1.1.4 h1:Qpu1GLRWfsU3srtodGYqJ2LmZErYYJPstRLUlyh+zCg= github.com/hyperledger/firefly-signer v1.1.4/go.mod h1:4h2MN910A2knrWGYCT+aWjBDlhptgQn/9WcT1N/Ct8s= github.com/hyperledger/firefly-transaction-manager v1.2.6 h1:Z6ozlIjWUle6W5YY4Oe1xSXqnAXU4FaetY1fpQDMCS0= github.com/hyperledger/firefly-transaction-manager v1.2.6/go.mod h1:MPsdnEu+MiWOAdcWr66fYW8cdxNZEKfw1AqGNx+TbNs= +github.com/hyperledger/firefly-transaction-manager v1.2.8 h1:QJDLBs04VTFwlfMvIyktePRy0CtfxCcSK24zV20uHNg= +github.com/hyperledger/firefly-transaction-manager v1.2.8/go.mod h1:cw8WaeziBv6WewOQVFIrkQcnv2ggJf9fnc/ztjzRorw= github.com/ianlancetaylor/demangle v0.0.0-20181102032728-5e5cf60278f6/go.mod h1:aSSvb/t6k1mPoxDqO4vJh6VOCGPwU4O0C2/Eqndh1Sc= github.com/ianlancetaylor/demangle v0.0.0-20200824232613-28f6c0f3b639/go.mod h1:aSSvb/t6k1mPoxDqO4vJh6VOCGPwU4O0C2/Eqndh1Sc= github.com/imdario/mergo v0.3.11/go.mod h1:jmQim1M+e3UYxmgPu/WyfjB3N3VflVyUjjjwH0dnCYA=