env

package
v0.28.0 Latest Latest
Warning

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

Go to latest
Published: Aug 7, 2025 License: MIT Imports: 6 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func AssertProperEnvKey

func AssertProperEnvKey(keys ...string) error

AssertProperEnvKeys asserts that all env. keys are proper (and not potentially passwords).

Types

type EnvList

type EnvList []string

func (EnvList) Find

func (l EnvList) Find(key string) string

Find finds the env. variable with `key`.

func (EnvList) FindAll

func (l EnvList) FindAll(keys ...string) (res EnvMap)

FindAll environment variables given in `keys`. If `keys` is nil, all env. variables are returned.

func (EnvList) FindIdx

func (l EnvList) FindIdx(key string) EnvValue

FindIdx finds the value of env. variable with key `key`.

func (EnvList) Remove added in v0.18.0

func (l EnvList) Remove(key ...string) EnvList

Filter filters the env. list by the env variables with key `key`.

type EnvMap

type EnvMap map[string]EnvValue

func NewEnvMapFromList

func NewEnvMapFromList(env EnvList) EnvMap

NewEnvMap returns the env. map from the environment list.

func (*EnvMap) AssertDefined

func (v *EnvMap) AssertDefined() error

Defined returns true if all env variables are defined.

func (*EnvMap) AssertNotEmpty

func (v *EnvMap) AssertNotEmpty() error

Defined returns true if all env variables are defined and not empty.

func (EnvMap) Get

func (v EnvMap) Get(key string) EnvValue

Get accesses the map safely, and panics when the key is not in the map. This is useful to accidentally mistype stuff.

type EnvValue

type EnvValue struct {
	Value string
	// contains filtered or unexported fields
}

func (*EnvValue) Defined

func (v *EnvValue) Defined() bool

Determines if this env. value is found in the `EnvList`.

func (*EnvValue) Idx

func (v *EnvValue) Idx() int

Idx returns the index of the value in the original `EnvList`.

Jump to

Keyboard shortcuts

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