Documentation ¶
Overview ¶
Package common implements common oasis-node command options and utilities.
Index ¶
- Constants
- Variables
- func DataDir() string
- func DataDirOrPwd() (string, error)
- func EarlyLogAndExit(err error)
- func ExportEntity(signerBackend, entityDir string) error
- func GetInputReader(cmd *cobra.Command, cfg string) (io.ReadCloser, bool, error)
- func GetOutputWriter(cmd *cobra.Command, cfg string) (io.WriteCloser, bool, error)
- func GetUserConfirmation(prompt string) bool
- func Init() error
- func InitConfig()
- func IsNodeCmd() bool
- func IsNotRootOrAllowed() (canRun bool, isRoot bool)
- func Isatty(fd uintptr) bool
- func LoadEntitySigner() (*entity.Entity, signature.Signer, error)
- func Logger() *logging.Logger
- func PrettyJSONMarshal(v interface{}) ([]byte, error)
- func SetBasicVersionTemplate(cmd *cobra.Command)
- func SetIsNodeCmd(v bool)
Constants ¶
const ( // CfgDebugAllowTestKeys is the command line flag to enable the debug test // keys. CfgDebugAllowTestKeys = "debug.allow_test_keys" // CfgDebugAllowDebugEnclaves is the command line flag to enable debug enclaves. CfgDebugAllowDebugEnclaves = "debug.allow_debug_enclaves" // CfgDebugRlimit is the command flag to set RLIMIT_NOFILE on launch. CfgDebugRlimit = "debug.rlimit" CfgConfigFile = "config" CfgDataDir = "datadir" // RequiredRlimit is the minimum required RLIMIT_NOFILE as too low of a // limit can cause problems with BadgerDB. RequiredRlimit = 50_000 )
Variables ¶
var ( // RootFlags has the flags that are common across all commands. RootFlags = flag.NewFlagSet("", flag.ContinueOnError) )
Functions ¶
func DataDirOrPwd ¶
DataDirOrPwd returns the data directory iff one is set, pwd otherwise.
func EarlyLogAndExit ¶
func EarlyLogAndExit(err error)
EarlyLogAndExit logs the error and exits.
Note: This routine should only be used prior to the logging system being initialized.
func ExportEntity ¶
ExportEntity creates an empty entity from the public key of the signer generated with the specified backend, and writes it to a file in entityDir.
func GetInputReader ¶
GetInputReader will open a file if the config string is set, and otherwise return os.Stdin.
func GetOutputWriter ¶
GetOutputWriter will create a file if the config string is set, and otherwise return os.Stdout.
func GetUserConfirmation ¶
GetUserConfirmation displays the prompt, and scans the input for the user's confirmation, until the user either explicitly confirms or rejects the prompt.
Note: If standard input is not a tty, this will omit displaying the prompt, and assume the user entered yes.
func InitConfig ¶
func InitConfig()
InitConfig initializes the command configuration.
WARNING: This is exposed for the benefit of tests and the interface is not guaranteed to be stable.
func IsNodeCmd ¶
func IsNodeCmd() bool
IsNodeCmd returns true iff the current command is the ekiden node.
func IsNotRootOrAllowed ¶ added in v0.2201.0
IsNotRootOrAllowed returns if the current user is allowed to run a node, and if the effective user id is elevated or not.
func LoadEntitySigner ¶ added in v0.2100.0
LoadEntitySigner loads the entity and its signer.
func PrettyJSONMarshal ¶ added in v0.2103.0
PrettyJSONMarshal returns pretty-printed JSON encoding of v.
func SetBasicVersionTemplate ¶ added in v0.2010.0
SetBasicVersionTemplate sets a basic custom version template for the given cobra command that shows the version of Oasis Core and the Go toolchain.
Types ¶
This section is empty.
Directories ¶
Path | Synopsis |
---|---|
Package background implements utilities for managing background services.
|
Package background implements utilities for managing background services. |
Package consensus contains common consensus-related flags.
|
Package consensus contains common consensus-related flags. |
Package context implements common context helpers.
|
Package context implements common context helpers. |
Package flags implements common flags used across multiple commands and backends.
|
Package flags implements common flags used across multiple commands and backends. |
Package genesis implements common genesis document manipulation routines.
|
Package genesis implements common genesis document manipulation routines. |
Package grpc implements common gRPC command-line flags.
|
Package grpc implements common gRPC command-line flags. |
Package metrics implements a prometheus metrics service.
|
Package metrics implements a prometheus metrics service. |
Package pprof implements a pprof profiling service.
|
Package pprof implements a pprof profiling service. |
Package signer implements helpers for configuring the signer.
|
Package signer implements helpers for configuring the signer. |