Skip to content

Commit

Permalink
remove --testnet flag. just output all info on init
Browse files Browse the repository at this point in the history
  • Loading branch information
ebuchman committed Mar 31, 2018
1 parent 29d878a commit 8170d87
Showing 1 changed file with 10 additions and 22 deletions.
32 changes: 10 additions & 22 deletions server/init.go
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,6 @@ import (
"io/ioutil"

"github.com/spf13/cobra"
"github.com/spf13/viper"

cmn "github.com/tendermint/tmlibs/common"
"github.com/tendermint/tmlibs/log"
Expand All @@ -17,10 +16,6 @@ import (
tmtypes "github.com/tendermint/tendermint/types"
)

const (
flagTestnet = "testnet"
)

type testnetInformation struct {
Secret string `json:"secret"`
Account string `json:"account"`
Expand All @@ -43,11 +38,10 @@ func InitCmd(gen GenAppState, logger log.Logger) *cobra.Command {
Short: "Initialize genesis files",
RunE: cmd.run,
}
cobraCmd.Flags().Bool(flagTestnet, false, "Output testnet information in JSON")
return &cobraCmd
}

// GenAppState can parse command-line and flag to
// GenAppState can parse command-line to
// generate default app_state for the genesis file.
// Also must return generated seed and address
// This is application-specific
Expand All @@ -62,10 +56,6 @@ func (c initCmd) run(cmd *cobra.Command, args []string) error {
// Store testnet information as we go
var testnetInfo testnetInformation

if viper.GetBool(flagTestnet) {
c.logger = log.NewFilter(c.logger, log.AllowError())
}

// Run the basic tendermint initialization,
// set up a default genesis with no app_options
config, err := tcmd.ParseConfig()
Expand Down Expand Up @@ -97,18 +87,16 @@ func (c initCmd) run(cmd *cobra.Command, args []string) error {
return err
}

if viper.GetBool(flagTestnet) {
nodeKey, err := p2p.LoadOrGenNodeKey(config.NodeKeyFile())
if err != nil {
return err
}
testnetInfo.NodeID = nodeKey.ID()
out, err := json.MarshalIndent(testnetInfo, "", " ")
if err != nil {
return err
}
fmt.Println(string(out))
nodeKey, err := p2p.LoadOrGenNodeKey(config.NodeKeyFile())
if err != nil {
return err
}
testnetInfo.NodeID = nodeKey.ID()
out, err := json.MarshalIndent(testnetInfo, "", " ")
if err != nil {
return err
}
fmt.Println(string(out))
return nil
}

Expand Down

0 comments on commit 8170d87

Please sign in to comment.