Skip to content

Commit

Permalink
generate keys in init
Browse files Browse the repository at this point in the history
  • Loading branch information
gartnera committed Jun 25, 2024
1 parent 8c2f52f commit 88b3e0c
Showing 1 changed file with 9 additions and 4 deletions.
13 changes: 9 additions & 4 deletions cmd/zetae2e/init.go
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ func NewInitCmd() *cobra.Command {
var InitCmd = &cobra.Command{
Use: "init",
Short: "initialize config file for e2e tests",
Run: initConfig,
RunE: initConfig,
}

InitCmd.Flags().StringVar(&initConf.RPCs.EVM, "ethURL", "http://eth:8545", "--ethURL http://eth:8545")
Expand All @@ -33,9 +33,14 @@ func NewInitCmd() *cobra.Command {
return InitCmd
}

func initConfig(_ *cobra.Command, _ []string) {
err := config.WriteConfig(configFile, initConf)
func initConfig(_ *cobra.Command, _ []string) error {
err := initConf.GenerateKeys()
if err != nil {
fmt.Printf("error writing config file: %s", err.Error())
return fmt.Errorf("generating keys: %w", err)
}
err = config.WriteConfig(configFile, initConf)
if err != nil {
return fmt.Errorf("writing config: %w", err)
}
return nil
}

0 comments on commit 88b3e0c

Please sign in to comment.