2017-08-30 22:21:32 +02:00
|
|
|
package main
|
|
|
|
|
|
|
|
import (
|
|
|
|
"os"
|
|
|
|
|
|
|
|
"github.com/tendermint/tmlibs/cli"
|
2017-08-31 10:34:45 +02:00
|
|
|
"github.com/tendermint/tmlibs/log"
|
|
|
|
|
|
|
|
tc "github.com/tendermint/tendermint/cmd/tendermint/commands"
|
|
|
|
cfg "github.com/tendermint/tendermint/config"
|
|
|
|
"github.com/tendermint/tendermint/types"
|
|
|
|
)
|
2017-08-30 22:21:32 +02:00
|
|
|
|
2017-08-31 10:34:45 +02:00
|
|
|
var (
|
|
|
|
config = cfg.DefaultConfig()
|
|
|
|
logger = log.NewTMLogger(log.NewSyncWriter(os.Stdout)).With("module", "main")
|
2017-08-30 22:21:32 +02:00
|
|
|
)
|
|
|
|
|
|
|
|
func main() {
|
|
|
|
// TODO: Make it easier to build a tendermint instance from scratch.
|
|
|
|
// All commands should be exported and it should be easy to override
|
|
|
|
// certain aspects of a single command.
|
|
|
|
// Probably every command should have a constructor that allows a user
|
|
|
|
// to vary the configuration. This is at least true for run_node.go
|
|
|
|
|
|
|
|
rootCmd := tc.RootCmd
|
|
|
|
rootCmd.AddCommand(tc.GenValidatorCmd)
|
|
|
|
rootCmd.AddCommand(tc.InitFilesCmd)
|
|
|
|
rootCmd.AddCommand(tc.ProbeUpnpCmd)
|
|
|
|
rootCmd.AddCommand(tc.ReplayCmd)
|
|
|
|
rootCmd.AddCommand(tc.ReplayConsoleCmd)
|
|
|
|
rootCmd.AddCommand(tc.ResetAllCmd)
|
|
|
|
rootCmd.AddCommand(tc.ResetPrivValidatorCmd)
|
|
|
|
rootCmd.AddCommand(tc.ShowValidatorCmd)
|
|
|
|
rootCmd.AddCommand(tc.TestnetFilesCmd)
|
|
|
|
rootCmd.AddCommand(tc.VersionCmd)
|
|
|
|
|
2017-08-31 10:34:45 +02:00
|
|
|
privValidator := types.LoadOrGenPrivValidator(config.PrivValidatorFile(), logger)
|
|
|
|
privValidator.SetSigner(types.NewDefaultSigner(privValidator.PrivKey))
|
|
|
|
rootCmd.AddCommand(tc.NewRunNodeCmd(privValidator))
|
2017-08-30 22:21:32 +02:00
|
|
|
|
|
|
|
cmd := cli.PrepareBaseCmd(rootCmd, "TM", os.ExpandEnv("$HOME/.tendermint"))
|
|
|
|
cmd.Execute()
|
|
|
|
}
|