github.com/Finschia/ostracon@v1.1.5/cmd/ostracon/main.go (about)

     1  package main
     2  
     3  import (
     4  	"os"
     5  	"path/filepath"
     6  
     7  	cmd "github.com/Finschia/ostracon/cmd/ostracon/commands"
     8  	"github.com/Finschia/ostracon/cmd/ostracon/commands/debug"
     9  	cfg "github.com/Finschia/ostracon/config"
    10  	"github.com/Finschia/ostracon/libs/cli"
    11  	nm "github.com/Finschia/ostracon/node"
    12  )
    13  
    14  func main() {
    15  	rootCmd := cmd.RootCmd
    16  	rootCmd.AddCommand(
    17  		cmd.GenValidatorCmd,
    18  		cmd.ProbeUpnpCmd,
    19  		cmd.LightCmd,
    20  		cmd.ReIndexEventCmd,
    21  		cmd.ReplayCmd,
    22  		cmd.ReplayConsoleCmd,
    23  		cmd.ResetAllCmd,
    24  		cmd.ResetPrivValidatorCmd,
    25  		cmd.ResetStateCmd,
    26  		cmd.ShowValidatorCmd,
    27  		cmd.TestnetFilesCmd,
    28  		cmd.ShowNodeIDCmd,
    29  		cmd.GenNodeKeyCmd,
    30  		cmd.VersionCmd,
    31  		cmd.RollbackStateCmd,
    32  		cmd.CompactGoLevelDBCmd,
    33  		debug.DebugCmd,
    34  		cli.NewCompletionCmd(rootCmd, true),
    35  	)
    36  
    37  	// NOTE:
    38  	// Users wishing to:
    39  	//	* Use an external signer for their validators
    40  	//	* Supply an in-proc abci app
    41  	//	* Supply a genesis doc file from another source
    42  	//	* Provide their own DB implementation
    43  	// can copy this file and use something other than the
    44  	// DefaultNewNode function
    45  	nodeFunc := nm.NewOstraconNode
    46  
    47  	// Create & start node
    48  	rootCmd.AddCommand(cmd.NewInitCmd())
    49  	rootCmd.AddCommand(cmd.NewRunNodeCmd(nodeFunc))
    50  
    51  	userHome, err := os.UserHomeDir()
    52  	if err != nil {
    53  		panic(err)
    54  	}
    55  	cmd := cli.PrepareBaseCmd(rootCmd, "OC", filepath.Join(userHome, cfg.DefaultOstraconDir))
    56  	if err := cmd.Execute(); err != nil {
    57  		panic(err)
    58  	}
    59  }