Documentation ¶
Overview ¶
Package env provides utilities for dealing with environment variables.
It is intended for internal use by buildkite-agent only.
Index ¶
- func Split(l string) (name, value string, ok bool)
- type Diff
- type DiffPair
- type Environment
- func (e Environment) Apply(diff Diff) Environment
- func (e Environment) Copy() Environment
- func (e Environment) Diff(other Environment) Diff
- func (e Environment) Exists(key string) bool
- func (e Environment) Get(key string) (string, bool)
- func (e Environment) GetBool(key string, defaultValue bool) bool
- func (e Environment) Length() int
- func (e Environment) MarshalJSON() ([]byte, error)
- func (e Environment) Merge(other Environment) Environment
- func (e Environment) Remove(key string) string
- func (e Environment) Set(key string, value string) string
- func (e Environment) ToSlice() []string
- func (e *Environment) UnmarshalJSON(data []byte) error
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
Types ¶
type Diff ¶ added in v3.33.0
type Environment ¶
Environment is a map of environment variables, with the keys normalized for case-insensitive operating systems
func FromSlice ¶
func FromSlice(s []string) Environment
FromSlice creates a new environment from a string slice of KEY=VALUE
func New ¶
func New() Environment
func (Environment) Apply ¶ added in v3.33.0
func (e Environment) Apply(diff Diff) Environment
func (Environment) Diff ¶
func (e Environment) Diff(other Environment) Diff
Diff returns a new environment with the keys and values from this environment which are different in the other one.
func (Environment) Exists ¶
func (e Environment) Exists(key string) bool
Exists returns true/false depending on whether or not the key exists in the env
func (Environment) Get ¶
func (e Environment) Get(key string) (string, bool)
Get returns a key from the environment
func (Environment) GetBool ¶
func (e Environment) GetBool(key string, defaultValue bool) bool
Get a boolean value from environment, with a default for empty. Supports true|false, on|off, 1|0
func (Environment) Length ¶
func (e Environment) Length() int
Length returns the length of the environment
func (Environment) MarshalJSON ¶ added in v3.40.0
func (e Environment) MarshalJSON() ([]byte, error)
func (Environment) Merge ¶
func (e Environment) Merge(other Environment) Environment
Merge merges another env into this one and returns the result
func (Environment) Remove ¶
func (e Environment) Remove(key string) string
Remove a key from the Environment and return its value
func (Environment) Set ¶
func (e Environment) Set(key string, value string) string
Set sets a key in the environment
func (Environment) ToSlice ¶
func (e Environment) ToSlice() []string
ToSlice returns a sorted slice representation of the environment
func (*Environment) UnmarshalJSON ¶ added in v3.40.0
func (e *Environment) UnmarshalJSON(data []byte) error