config: github.com/drone/config Index | Files

package config

import "github.com/drone/config"

Index

Package Files

config.go

Constants

const (
    ContinueOnError flag.ErrorHandling = flag.ContinueOnError
    ExitOnError     flag.ErrorHandling = flag.ExitOnError
    PanicOnError    flag.ErrorHandling = flag.PanicOnError
)

func Bool Uses

func Bool(name string, value bool) *bool

Bool defines a bool config variable with a given name and default value.

func BoolVar Uses

func BoolVar(p *bool, name string, value bool)

BoolVar defines a bool config with a given name and default value. The argument p points to a bool variable in which to store the value of the config.

func Duration Uses

func Duration(name string, value time.Duration) *time.Duration

Duration defines a time.Duration config variable with a given name and default value.

func DurationVar Uses

func DurationVar(p *time.Duration, name string, value time.Duration)

DurationVar defines a time.Duration config with a given name and default value. The argument p points to a time.Duration variable in which to store the value of the config.

func Float64 Uses

func Float64(name string, value float64) *float64

Float64 defines a float64 config variable with a given name and default value.

func Float64Var Uses

func Float64Var(p *float64, name string, value float64)

Float64Var defines a float64 config with a given name and default value. The argument p points to a float64 variable in which to store the value of the config.

func Int Uses

func Int(name string, value int) *int

Int defines a int config variable with a given name and default value.

func Int64 Uses

func Int64(name string, value int64) *int64

Int64 defines a int64 config variable with a given name and default value.

func Int64Var Uses

func Int64Var(p *int64, name string, value int64)

Int64Var defines a int64 config with a given name and default value. The argument p points to a int64 variable in which to store the value of the config.

func IntVar Uses

func IntVar(p *int, name string, value int)

IntVar defines a int config with a given name and default value. The argument p points to a int variable in which to store the value of the config.

func Parse Uses

func Parse(path string) error

Parse takes a path to a TOML file and loads it into the global ConfigSet. This must be called after all config flags have been defined but before the flags are accessed by the program.

func ParseBytes Uses

func ParseBytes(data []byte) error

ParseBytes takes a TOML file in byte array format and loads it into the global ConfigSet. This must be called after all config flags have been defined but before the flags are accessed by the program.

func SetPrefix Uses

func SetPrefix(prefix string)

SetPrefix sets the applicatin prefix to use when filtering environment variables. If prefix is empty, all environment variables are ignored.

func String Uses

func String(name string, value string) *string

String defines a string config variable with a given name and default value.

func StringVar Uses

func StringVar(p *string, name string, value string)

StringVar defines a string config with a given name and default value. The argument p points to a string variable in which to store the value of the config.

func Uint Uses

func Uint(name string, value uint) *uint

Uint defines a uint config variable with a given name and default value.

func Uint64 Uses

func Uint64(name string, value uint64) *uint64

Uint64 defines a uint64 config variable with a given name and default value.

func Uint64Var Uses

func Uint64Var(p *uint64, name string, value uint64)

Uint64Var defines a uint64 config with a given name and default value. The argument p points to a uint64 variable in which to store the value of the config.

func UintVar Uses

func UintVar(p *uint, name string, value uint)

UintVar defines a uint config with a given name and default value. The argument p points to a uint variable in which to store the value of the config.

func Var Uses

func Var(value flag.Value, name string)

Var defines a flag with the specified name and usage string. The type and value of the flag are represented by the first argument, of type Value, which typically holds a user-defined implementation of Value.

type ConfigSet Uses

type ConfigSet struct {
    *flag.FlagSet
    // contains filtered or unexported fields
}

func NewConfigSet Uses

func NewConfigSet(name string, errorHandling flag.ErrorHandling) *ConfigSet

NewConfigSet returns a new ConfigSet with the given name and error handling policy. The three valid error handling policies are: flag.ContinueOnError, flag.ExitOnError, and flag.PanicOnError.

func (*ConfigSet) Bool Uses

func (c *ConfigSet) Bool(name string, value bool) *bool

Bool defines a bool config variable with a given name and default value for a ConfigSet.

func (*ConfigSet) BoolVar Uses

func (c *ConfigSet) BoolVar(p *bool, name string, value bool)

BoolVar defines a bool config with a given name and default value for a ConfigSet. The argument p points to a bool variable in which to store the value of the config.

func (*ConfigSet) Duration Uses

func (c *ConfigSet) Duration(name string, value time.Duration) *time.Duration

Duration defines a time.Duration config variable with a given name and default value.

func (*ConfigSet) DurationVar Uses

func (c *ConfigSet) DurationVar(p *time.Duration, name string, value time.Duration)

DurationVar defines a time.Duration config with a given name and default value for a ConfigSet. The argument p points to a time.Duration variable in which to store the value of the config.

func (*ConfigSet) Float64 Uses

func (c *ConfigSet) Float64(name string, value float64) *float64

Float64 defines a float64 config variable with a given name and default value for a ConfigSet.

func (*ConfigSet) Float64Var Uses

func (c *ConfigSet) Float64Var(p *float64, name string, value float64)

Float64Var defines a float64 config with a given name and default value for a ConfigSet. The argument p points to a float64 variable in which to store the value of the config.

func (*ConfigSet) Int Uses

func (c *ConfigSet) Int(name string, value int) *int

Int defines a int config variable with a given name and default value for a ConfigSet.

func (*ConfigSet) Int64 Uses

func (c *ConfigSet) Int64(name string, value int64) *int64

Int64 defines a int64 config variable with a given name and default value for a ConfigSet.

func (*ConfigSet) Int64Var Uses

func (c *ConfigSet) Int64Var(p *int64, name string, value int64)

Int64Var defines a int64 config with a given name and default value for a ConfigSet. The argument p points to a int64 variable in which to store the value of the config.

func (*ConfigSet) IntVar Uses

func (c *ConfigSet) IntVar(p *int, name string, value int)

IntVar defines a int config with a given name and default value for a ConfigSet. The argument p points to a int variable in which to store the value of the config.

func (*ConfigSet) Parse Uses

func (c *ConfigSet) Parse(path string) error

Parse takes a path to a TOML file and loads it. This must be called after all the config flags in the ConfigSet have been defined but before the flags are accessed by the program.

If the path is empty, no TOML file is loaded. Only environment variables matching the application Prefix will populate the config flags.

func (*ConfigSet) ParseBytes Uses

func (c *ConfigSet) ParseBytes(data []byte) error

ParseBytes takes a TOML file in byte array format and loads it. This must be called after all the config flags in the ConfigSet have been defined but before the flags are accessed by the program.

func (*ConfigSet) SetPrefix Uses

func (c *ConfigSet) SetPrefix(prefix string)

SetPrefix sets the applicatin prefix to use when filtering environment variables. If prefix is empty, all environment variables are ignored.

func (*ConfigSet) String Uses

func (c *ConfigSet) String(name string, value string) *string

String defines a string config variable with a given name and default value for a ConfigSet.

func (*ConfigSet) StringVar Uses

func (c *ConfigSet) StringVar(p *string, name string, value string)

StringVar defines a string config with a given name and default value for a ConfigSet. The argument p points to a string variable in which to store the value of the config.

func (*ConfigSet) Strings Uses

func (c *ConfigSet) Strings(name string) *StringParams

Strings defines a string slice config variable with a given name.

func (*ConfigSet) Uint Uses

func (c *ConfigSet) Uint(name string, value uint) *uint

Uint defines a uint config variable with a given name and default value for a ConfigSet.

func (*ConfigSet) Uint64 Uses

func (c *ConfigSet) Uint64(name string, value uint64) *uint64

Uint64 defines a uint64 config variable with a given name and default value for a ConfigSet.

func (*ConfigSet) Uint64Var Uses

func (c *ConfigSet) Uint64Var(p *uint64, name string, value uint64)

Uint64Var defines a uint64 config with a given name and default value for a ConfigSet. The argument p points to a uint64 variable in which to store the value of the config.

func (*ConfigSet) UintVar Uses

func (c *ConfigSet) UintVar(p *uint, name string, value uint)

UintVar defines a uint config with a given name and default value for a ConfigSet. The argument p points to a uint variable in which to store the value of the config.

func (*ConfigSet) Var Uses

func (c *ConfigSet) Var(value flag.Value, name string)

Var defines a flag with the specified name and usage string. The type and value of the flag are represented by the first argument, of type Value, which typically holds a user-defined implementation of Value.

type StringParams Uses

type StringParams []string

func Strings Uses

func Strings(name string) *StringParams

Strings defines a string slice config variable with a given name.

func (*StringParams) Set Uses

func (s *StringParams) Set(value string) error

func (*StringParams) String Uses

func (s *StringParams) String() string

Package config imports 7 packages (graph) and is imported by 241 packages. Updated 2018-04-12. Refresh now. Tools for package owners.