process

package
v0.24.4 Latest Latest
Warning

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

Go to latest
Published: Oct 25, 2019 License: AGPL-3.0 Imports: 41 Imported by: 0

Documentation

Index

Constants

View Source
const DefaultCfgFilename = "config.yaml"

DefaultCfgFilename is the default filename used for storing a configuration.

Variables

View Source
var (
	// Error is a process error class
	Error = errs.Class("process error")
)

Functions

func Bind added in v0.13.0

func Bind(cmd *cobra.Command, config interface{}, opts ...cfgstruct.BindOpt)

Bind sets flags on a command that match the configuration struct 'config'. It ensures that the config has all of the values loaded into it when the command runs.

func Ctx

Ctx returns the appropriate context.Context for ExecuteWithConfig commands

func Exec

func Exec(cmd *cobra.Command)

Exec runs a Cobra command. If a "config" flag is defined it will be parsed and loaded using viper.

func InitMetrics

func InitMetrics(ctx context.Context, log *zap.Logger, r *monkit.Registry, instanceID string) (err error)

InitMetrics initializes telemetry reporting. Makes a telemetry.Client and calls its Run() method in a goroutine.

func InitMetricsWithCertPath

func InitMetricsWithCertPath(ctx context.Context, log *zap.Logger, r *monkit.Registry, certPath string) error

InitMetricsWithCertPath initializes telemetry reporting, using the node ID corresponding to the given certificate as the telemetry instance ID.

func SaveConfig

func SaveConfig(cmd *cobra.Command, outfile string, opts ...SaveConfigOption) error

SaveConfig will save only the user-specific flags with default values to outfile with specific values specified in 'overrides' overridden.

func Viper added in v0.17.0

func Viper(cmd *cobra.Command) (*viper.Viper, error)

Viper returns the appropriate *viper.Viper for the command, creating if necessary.

Types

type SaveConfigOption added in v0.17.0

type SaveConfigOption func(*SaveConfigOptions)

SaveConfigOption is a function that updates the options for SaveConfig.

func SaveConfigRemovingDeprecated added in v0.17.0

func SaveConfigRemovingDeprecated() SaveConfigOption

SaveConfigRemovingDeprecated tells SaveConfig to not store deprecated flags.

func SaveConfigWithOverride added in v0.17.0

func SaveConfigWithOverride(name string, value interface{}) SaveConfigOption

SaveConfigWithOverride adds a single override to SaveConfig.

func SaveConfigWithOverrides added in v0.17.0

func SaveConfigWithOverrides(overrides map[string]interface{}) SaveConfigOption

SaveConfigWithOverrides sets the overrides to the provided map.

type SaveConfigOptions added in v0.17.0

type SaveConfigOptions struct {
	Overrides        map[string]interface{}
	RemoveDeprecated bool
}

SaveConfigOptions controls the behavior of SaveConfig.

Jump to

Keyboard shortcuts

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