Skip to content

Commit

Permalink
Add init cmd flag
Browse files Browse the repository at this point in the history
  • Loading branch information
agouin committed Jun 4, 2024
1 parent 8c03918 commit cfb1bc9
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 4 deletions.
13 changes: 9 additions & 4 deletions cmd/horcrux/cmd/config.go
Original file line number Diff line number Diff line change
Expand Up @@ -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 {
Expand Down Expand Up @@ -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)
Expand All @@ -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 {
Expand All @@ -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 {
Expand Down Expand Up @@ -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
}
2 changes: 2 additions & 0 deletions cmd/horcrux/cmd/config_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -48,6 +48,7 @@ chainNodes:
- privValAddr: tcp://10.168.0.2:1234
debugAddr: ""
grpcAddr: ""
maxReadSize: 1048576
`,
},
{
Expand All @@ -64,6 +65,7 @@ chainNodes:
- privValAddr: tcp://10.168.0.2:1234
debugAddr: ""
grpcAddr: ""
maxReadSize: 1048576
`,
},
{
Expand Down

0 comments on commit cfb1bc9

Please sign in to comment.