config

package
v0.16.24 Latest Latest
Warning

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

Go to latest
Published: Jan 12, 2022 License: BSD-3-Clause Imports: 5 Imported by: 2

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func AllSettings added in v0.12.54

func AllSettings() map[string]interface{}

func BindCmdFlags

func BindCmdFlags(cmd *cobra.Command) error

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 ReadFile added in v0.12.54

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

func Set

func Set(key string, val interface{})

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)

func SetFlags

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

func SetPersistentFlags

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

Types

type Config added in v0.14.3

type Config struct {
	// contains filtered or unexported fields
}

func Global added in v0.14.4

func Global() *Config

func New added in v0.14.3

func New() *Config

func (*Config) AllSettings added in v0.14.3

func (c *Config) AllSettings() map[string]interface{}

func (*Config) BindCmdFlags added in v0.14.3

func (c *Config) 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 (*Config) GetBool added in v0.14.3

func (c *Config) GetBool(key string) bool

func (*Config) GetDuration added in v0.14.3

func (c *Config) GetDuration(key string) time.Duration

func (*Config) GetInt added in v0.14.3

func (c *Config) GetInt(key string) int

func (*Config) GetInt32 added in v0.14.3

func (c *Config) GetInt32(key string) int32

func (*Config) GetInt32Slice added in v0.14.3

func (c *Config) GetInt32Slice(key string) []int32

func (*Config) GetInt64 added in v0.14.3

func (c *Config) GetInt64(key string) int64

func (*Config) GetInt64Slice added in v0.14.3

func (c *Config) GetInt64Slice(key string) []int64

func (*Config) GetIntSlice added in v0.14.3

func (c *Config) GetIntSlice(key string) []int

func (*Config) GetString added in v0.14.3

func (c *Config) GetString(key string) string

func (*Config) GetStringSlice added in v0.14.3

func (c *Config) GetStringSlice(key string) []string

func (*Config) GetTime added in v0.14.3

func (c *Config) GetTime(key string) time.Time

func (*Config) GetUint added in v0.14.3

func (c *Config) GetUint(key string) uint

func (*Config) GetUint32 added in v0.14.3

func (c *Config) GetUint32(key string) uint32

func (*Config) GetUint64 added in v0.14.3

func (c *Config) GetUint64(key string) uint64

func (*Config) ReadFile added in v0.14.3

func (c *Config) ReadFile(configFileName string, configSearchPaths ...string) error

func (*Config) Set added in v0.14.3

func (c *Config) 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 (*Config) SetEnvPrefix added in v0.14.3

func (c *Config) 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_".

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