From cfb1bc94b57b46c323202829fc583f168370eba2 Mon Sep 17 00:00:00 2001 From: Andrew Gouin Date: Tue, 4 Jun 2024 10:58:52 -0600 Subject: [PATCH] Add init cmd flag --- cmd/horcrux/cmd/config.go | 13 +++++++++---- cmd/horcrux/cmd/config_test.go | 2 ++ 2 files changed, 11 insertions(+), 4 deletions(-) diff --git a/cmd/horcrux/cmd/config.go b/cmd/horcrux/cmd/config.go index a39b7315..6cdc6695 100644 --- a/cmd/horcrux/cmd/config.go +++ b/cmd/horcrux/cmd/config.go @@ -18,7 +18,8 @@ const ( flagGRPCTimeout = "grpc-timeout" flagOverwrite = "overwrite" flagBare = "bare" - flagGRPCAddress = "flagGRPCAddress" + flagGRPCAddress = "gprc-address" + flagMaxReadSize = "max-read-size" ) func configCmd() *cobra.Command { @@ -70,6 +71,7 @@ for threshold signer mode, --cosigner flags and --threshold flag are required. } debugAddr, _ := cmdFlags.GetString(flagDebugAddr) grpcAddr, _ := cmdFlags.GetString(flagGRPCAddress) + maxReadSize, _ := cmdFlags.GetInt(flagMaxReadSize) if signMode == string(signer.SignModeThreshold) { // Threshold Mode Config cosignersFlag, _ := cmdFlags.GetStringSlice(flagCosigner) @@ -90,9 +92,10 @@ for threshold signer mode, --cosigner flags and --threshold flag are required. GRPCTimeout: grpcTimeout, RaftTimeout: raftTimeout, }, - ChainNodes: cn, - DebugAddr: debugAddr, - GRPCAddr: grpcAddr, + ChainNodes: cn, + DebugAddr: debugAddr, + GRPCAddr: grpcAddr, + MaxReadSize: maxReadSize, } if !bare { @@ -107,6 +110,7 @@ for threshold signer mode, --cosigner flags and --threshold flag are required. PrivValKeyDir: keyDir, ChainNodes: cn, DebugAddr: debugAddr, + MaxReadSize: maxReadSize, } if !bare { if err = cfg.ValidateSingleSignerConfig(); err != nil { @@ -162,5 +166,6 @@ for threshold signer mode, --cosigner flags and --threshold flag are required. "allows initialization without providing any flags. If flags are provided, will not perform final validation", ) f.StringP(flagGRPCAddress, "g", "", "GRPC address if listener should be enabled") + f.Int(flagMaxReadSize, 1024*1024, "max read size for remote signer connection") return cmd } diff --git a/cmd/horcrux/cmd/config_test.go b/cmd/horcrux/cmd/config_test.go index fae9db5e..dc5e492b 100644 --- a/cmd/horcrux/cmd/config_test.go +++ b/cmd/horcrux/cmd/config_test.go @@ -48,6 +48,7 @@ chainNodes: - privValAddr: tcp://10.168.0.2:1234 debugAddr: "" grpcAddr: "" +maxReadSize: 1048576 `, }, { @@ -64,6 +65,7 @@ chainNodes: - privValAddr: tcp://10.168.0.2:1234 debugAddr: "" grpcAddr: "" +maxReadSize: 1048576 `, }, {