cmd

package
v0.2.5 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Apr 24, 2020 License: MIT Imports: 27 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var RootCmd = &cobra.Command{
	Use:   "noah",
	Short: "Noah Go Node",
	PersistentPreRun: func(cmd *cobra.Command, args []string) {
		config.UpdateDefaultPathAndDir()

		cfg = config.GetConfig()

		v := viper.New()
		v.SetConfigFile(utils.GetNoahConfigPath(config.NetworkId))
		if err := v.ReadInConfig(); err != nil {
			panic(err)
		}

		if err := v.Unmarshal(cfg); err != nil {
			panic(err)
		}

		validatorMode, err := cmd.Flags().GetBool("validator-mode")
		if err != nil {
			panic(err)
		}
		cfg.ValidatorMode = validatorMode

		if cfg.ValidatorMode {
			fmt.Println("This node working in validator mode.")
		} else {
			fmt.Println("This node working NOT in validator mode.")
		}

		fmt.Println("Current chain id", config.ChainId)
		log.InitLog(cfg)
	},
}
View Source
var RunNode = &cobra.Command{
	Use:   "node",
	Short: "Run the Noah node",
	RunE: func(cmd *cobra.Command, args []string) error {
		return runNode()
	},
}
View Source
var ShowNodeId = &cobra.Command{
	Use:   "show_node_id",
	Short: "Show this node's ID",
	RunE:  showNodeId,
}
View Source
var ShowValidator = &cobra.Command{
	Use:   "show_validator",
	Short: "Show this node's validator public key",
	RunE:  showValidator,
}
View Source
var Version = &cobra.Command{
	Use:   "version",
	Short: "Show this node's version",
	RunE: func(cmd *cobra.Command, args []string) error {
		fmt.Println(version.Version)
		return nil
	},
}

Functions

This section is empty.

Types

This section is empty.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL