Documentation ¶
Index ¶
- Constants
- func Restore()
- func SetEnv(vars Vars)
- type Marshaler
- type Vars
- func (ev Vars) Base64(envVar string, defaults ...[]byte) ([]byte, error)
- func (ev Vars) Bool(envVar string, defaults ...bool) bool
- func (ev Vars) Bytes(envVar string, defaults ...[]byte) []byte
- func (ev Vars) CSV(envVar string, defaults ...string) []string
- func (ev Vars) Delete(key string)
- func (ev Vars) Duration(envVar string, defaults ...time.Duration) (time.Duration, error)
- func (ev Vars) Float64(envVar string, defaults ...float64) (float64, error)
- func (ev Vars) Has(envVar string) bool
- func (ev Vars) HasAll(envVars ...string) bool
- func (ev Vars) HasAny(envVars ...string) bool
- func (ev Vars) Int(envVar string, defaults ...int) (int, error)
- func (ev Vars) Int32(envVar string, defaults ...int32) (int32, error)
- func (ev Vars) Int64(envVar string, defaults ...int64) (int64, error)
- func (ev Vars) Must(keys ...string)
- func (ev Vars) MustBase64(envVar string, defaults ...[]byte) []byte
- func (ev Vars) MustDuration(envVar string, defaults ...time.Duration) time.Duration
- func (ev Vars) MustFloat64(envVar string, defaults ...float64) float64
- func (ev Vars) MustInt(envVar string, defaults ...int) int
- func (ev Vars) MustInt32(envVar string, defaults ...int32) int32
- func (ev Vars) MustInt64(envVar string, defaults ...int64) int64
- func (ev Vars) MustUint32(envVar string, defaults ...uint32) uint32
- func (ev Vars) MustUint64(envVar string, defaults ...uint64) uint64
- func (ev Vars) Raw() []string
- func (ev Vars) ReadFile(path string) error
- func (ev Vars) ReadInto(obj interface{}) error
- func (ev Vars) Require(keys ...string) error
- func (ev Vars) Restore(key string)
- func (ev Vars) Set(envVar, value string)
- func (ev Vars) String(envVar string, defaults ...string) string
- func (ev Vars) Uint32(envVar string, defaults ...uint32) (uint32, error)
- func (ev Vars) Uint64(envVar string, defaults ...uint64) (uint64, error)
- func (ev Vars) Union(other Vars) Vars
- func (ev Vars) Vars() []string
Constants ¶
const ( // TagNameEnvironmentVariableName is the struct tag for what environment variable to use to populate a field. TagNameEnvironmentVariableName = "env" // FlagCSV is a field tag flag (say that 10 times fast). FlagCSV = "csv" // FlagBase64 is a field tag flag (say that 10 times fast). FlagBase64 = "base64" // FlagBytes is a field tag flag (say that 10 times fast). FlagBytes = "bytes" )
Variables ¶
This section is empty.
Functions ¶
Types ¶
type Vars ¶
Vars is a set of environment variables.
func NewVarsFromEnvironment ¶
func NewVarsFromEnvironment() Vars
NewVarsFromEnvironment reads an EnvVar set from the environment.
func (Vars) Base64 ¶
Base64 returns a []byte value for a given key whose value is encoded in base64.
func (Vars) Bool ¶
Bool returns a boolean value for a key, defaulting to false. Valid "truthy" values are `true`, `yes`, and `1`. Everything else is false, including `REEEEEEEEEEEEEEE`.
func (Vars) Must ¶
Must enforces that a given set of environment variables are present and panics if they're not present.
func (Vars) MustBase64 ¶
MustBase64 returns a []byte value for a given key encoded with base64, and panics if malformed.
func (Vars) MustDuration ¶
MustDuration returnss a duration value for a given key and panics if malformed.
func (Vars) MustFloat64 ¶
MustFloat64 returns an float64 value for a given key and panics if it is malformed.
func (Vars) MustInt ¶
MustInt returns an integer value for a given key and panics if it is malformed.
func (Vars) MustInt32 ¶
MustInt32 returns an integer value for a given key and panics if it is malformed.
func (Vars) MustInt64 ¶
MustInt64 returns an int64 value for a given key and panics if it is malformed.
func (Vars) MustUint32 ¶
MustUint32 returns an uint32 value for a given key and panics if it is malformed.
func (Vars) MustUint64 ¶
MustUint64 returns an uint64 value for a given key and panics if it is malformed.