cmd

package
Version: v0.6.0 Latest Latest
Warning

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

Go to latest
Published: Jun 5, 2021 License: GPL-3.0 Imports: 9 Imported by: 2

Documentation

Overview

Package cmd defines the command line flags for the shared utlities.

Index

Constants

This section is empty.

Variables

View Source
var (
	DumpConfigCommand = &cli.Command{
		Action:      dumpConfig,
		Name:        "dumpconfig",
		Usage:       "Show configuration values",
		ArgsUsage:   "",
		Category:    "MISCELLANEOUS COMMANDS",
		Description: `The dumpconfig command shows configuration values.`,
	}

	GenConfigCommand = &cli.Command{
		Action:      genConfig,
		Name:        "genconfig",
		Usage:       "godbledger genconfig [-m] [configFileLocation]",
		ArgsUsage:   "",
		Category:    "MISCELLANEOUS COMMANDS",
		Description: `The init command creates a configuration file at the optional [configFileLocation] else will default to HOME/.ledger/config.toml`,
		Flags: []cli.Flag{
			&cli.BoolFlag{
				Name:    "mysql",
				Aliases: []string{"m"},
				Usage:   "set the database to use mysql rather than sqlite"},
		},
	}
)
View Source
var (
	// VerbosityFlag defines the logrus configuration.
	VerbosityFlag = &cli.StringFlag{
		Name:  "verbosity",
		Usage: "Logging verbosity (debug, info=default, warn, error, fatal, panic)",
	}
	// DataDirFlag defines a path on disk.
	DataDirFlag = &cli.StringFlag{
		Name:  "datadir",
		Usage: "Data directory for the databases and keystore",
	}
	// ClearDB tells the node to remove any previously stored data at the data directory.
	ClearDB = &cli.BoolFlag{
		Name:  "clear-db",
		Usage: "Clears any previously stored data at the data directory",
	}
	ConfigFileFlag = &cli.StringFlag{
		Name:  "config",
		Usage: "TOML configuration file",
	}
	// RPCHost defines the host on which the RPC server should listen.
	RPCHost = &cli.StringFlag{
		Name:  "rpc-host",
		Usage: "Host on which the RPC server should listen",
	}
	// RPCPort defines a beacon node RPC port to open.
	RPCPort = &cli.StringFlag{
		Name:  "rpc-port",
		Usage: "RPC port exposed by GoDBLedger",
	}
	// CertFlag defines a flag for the node's TLS CA certificate.
	CACertFlag = &cli.StringFlag{
		Name:  "ca-cert",
		Usage: "Certificate Authority certificate for secure gRPC. Pass this and the tls-key flag in order to use gRPC securely.",
	}
	// CertFlag defines a flag for the node's TLS certificate.
	CertFlag = &cli.StringFlag{
		Name:  "tls-cert",
		Usage: "Certificate for secure gRPC. Pass this and the tls-key flag in order to use gRPC securely.",
	}
	// KeyFlag defines a flag for the node's TLS key.
	KeyFlag = &cli.StringFlag{
		Name:  "tls-key",
		Usage: "Key for secure gRPC. Pass this and the tls-cert flag in order to use gRPC securely.",
	}
	// LogFileName specifies the log output file name.
	LogFileName = &cli.StringFlag{
		Name:  "log-file",
		Usage: "Specify log file name, relative or absolute",
	}
	// DatabaseType specifies the backend for GoDBLedger
	DatabaseTypeFlag = &cli.StringFlag{
		Name:  "database",
		Usage: "Specify database type, sqlite3 or mysql",
	}
	// DatabaseLocation specifies file location for Sqlite or connection string for MySQL
	DatabaseLocationFlag = &cli.StringFlag{
		Name:  "database-location",
		Usage: "location of database file or connection string",
	}
)

Functions

func ConfigurePersistentLogging added in v0.4.0

func ConfigurePersistentLogging(logFileName string) error

ConfigurePersistentLogging adds a log-to-file writer. File content is identical to stdout.

func DefaultDataDir

func DefaultDataDir() string

DefaultDataDir is the default data directory to use for the databases and other persistence requirements.

func InitConfig

func InitConfig(config *LedgerConfig) error

Types

type LedgerConfig

type LedgerConfig struct {
	Host             string // Host defines the address that the RPC will be opened on. Combined with RPC Port
	RPCPort          string // RPCPort defines the port that the server will listen for transactions on
	CACert           string // CACertFlag defines a flag for the server's Certificate Authority certificate (Public Key of Authority that signs clients Public Keys).
	Cert             string // CertFlag defines a flag for the server's TLS certificate (Servers Public Key to broadcast).
	Key              string // KeyFlag defines a flag for the server's TLS key (Servers Private Key).
	DataDirectory    string // DataDirectory defines the host systems folder directory holding the database and config files
	LogVerbosity     string // LogVerbosity defines the logging level {debug, info, warn, error, fatal, panic}
	ConfigFile       string // Location of the TOML config file, including directory path
	DatabaseType     string // Type of Database being used
	DatabaseLocation string // Location of the database file, including directory path or connection string
}

func MakeConfig

func MakeConfig(cli *cli.Context) (error, *LedgerConfig)

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
t or T : Toggle theme light dark auto
y or Y : Canonical URL