config

package
v0.6.31 Latest Latest
Warning

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

Go to latest
Published: Apr 1, 2021 License: BSD-3-Clause Imports: 5 Imported by: 2

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func BindCmdFlags

func BindCmdFlags(cmd *cobra.Command) error

BindCmdFlags binds a full flag set to the configuration, using each flag's long name as the config key.

func GetBool

func GetBool(key string) bool

func GetDuration

func GetDuration(key string) time.Duration

func GetInt

func GetInt(key string) int

func GetInt32

func GetInt32(key string) int32

func GetInt32Slice added in v0.6.20

func GetInt32Slice(key string) []int32

func GetInt64

func GetInt64(key string) int64

func GetInt64Slice added in v0.6.20

func GetInt64Slice(key string) []int64

func GetIntSlice

func GetIntSlice(key string) []int

func GetString

func GetString(key string) string

func GetStringSlice

func GetStringSlice(key string) []string

func GetTime

func GetTime(key string) time.Time

func GetUint

func GetUint(key string) uint

func GetUint32

func GetUint32(key string) uint32

func GetUint64

func GetUint64(key string) uint64

func Init

func Init(configFileName string, configSearchPaths ...string) error

func MustInit

func MustInit(configFileName string, configSearchPaths ...string)

func Set

func Set(key string, val interface{})

Set sets the value for the key in the override register. Set is case-insensitive for a key. Will be used instead of values obtained via flags, config file, ENV, default, or key/value store.

func SetCmdFlags

func SetCmdFlags(cmd *cobra.Command, opts ...FlagOption)

SetCmdFlags sets the flags defined by FlagOption to the command 'cmd'.

func SetCmdPersistentFlags

func SetCmdPersistentFlags(cmd *cobra.Command, opts ...FlagOption)

SetCmdPersistentFlags sets the persistent flags defined by FlagOption to the command 'cmd'.

func SetEnvPrefix

func SetEnvPrefix(prefix string)

SetEnvPrefix defines a prefix that ENVIRONMENT variables will use. // E.g. if your prefix is "spf", the env registry will look for env // variables that start with "SPF_".

func SetFlags

func SetFlags(cmd *cobra.Command, opts ...FlagOption)

func SetPersistentFlags

func SetPersistentFlags(cmd *cobra.Command, opts ...FlagOption)

Types

type FlagOption

type FlagOption func(fs *pflag.FlagSet)

func BoolFlag

func BoolFlag(name string, value bool, usage string) FlagOption

func DurationFlag

func DurationFlag(name string, value time.Duration, usage string) FlagOption

func Int32Flag

func Int32Flag(name string, value int32, usage string) FlagOption

func Int64Flag

func Int64Flag(name string, value int64, usage string) FlagOption

func Int64SliceFlag

func Int64SliceFlag(name string, value []int64, usage string) FlagOption

func IntFlag

func IntFlag(name string, value int, usage string) FlagOption

func StringFlag

func StringFlag(name, value, usage string) FlagOption

func StringSliceFlag

func StringSliceFlag(name string, value []string, usage string) FlagOption

func Uint32Flag added in v0.3.2

func Uint32Flag(name string, value uint32, usage string) FlagOption

func Uint64Flag added in v0.3.2

func Uint64Flag(name string, value uint64, usage string) FlagOption

Jump to

Keyboard shortcuts

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