config

package
v3.16.3 Latest Latest
Warning

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

Go to latest
Published: Apr 10, 2024 License: Apache-2.0 Imports: 3 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Cfgentry

type Cfgentry struct {
	Flag        string
	Env         string
	Description string
	Value       string
}

Cfgentry holds the information to create a flag and a corresponding environment variable used to providing configuration to a plugin

type Config

type Config map[string]Cfgentry

Config is a map of Cfgentry keyed by the Flag value

func (Config) Add

func (c Config) Add(ce Cfgentry)

Add will add a new entry to the Config keyed by the Flag value

func (Config) Clone

func (c Config) Clone() Config

Clone will clone the Config and return the copy

func (Config) FromEnv

func (c Config) FromEnv() error

FromEnv will update the Config by reading the values from the environment variables specified by the Env field

func (Config) FromFlags

func (c Config) FromFlags(flags map[string]interface{}) error

FromFlags will update the Config with the values from a map of command flags to values

func (Config) Get

func (c Config) Get(flag string) string

Get will return the Value field from the Config

func (Config) ToEnv

func (c Config) ToEnv() []string

ToEnv will set the environment variables specified by the Env fields of the Config to their corresponding Value

Jump to

Keyboard shortcuts

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