Documentation
¶
Overview ¶
Package envfile parses .env files into key/value pairs.
Index ¶
Constants ¶
This section is empty.
Variables ¶
var ErrNotFound = errors.New("no volcano.env file found.\ncreate volcano/volcano.env or use --file to specify a path")
ErrNotFound is returned when no path is given and neither default location holds an env file.
Functions ¶
func HasKey ¶ added in v0.48.0
HasKey reports whether the env file at path sets any of keys. A missing file sets none.
func LoadFirstEnvVars ¶
LoadFirstEnvVars reads the first existing env file from candidates and returns its variables as sorted KEY=value entries. If no candidate exists, it returns nil and no error.
func ResolvePath ¶ added in v0.45.0
ResolvePath returns the env file Load would read. An explicit path must exist; otherwise it looks for volcano/volcano.env and ./volcano.env, returns ErrNotFound when neither exists, and an error when both do.
func Upsert ¶ added in v0.48.0
Upsert sets vars in the env file at path, keeping every other line and comment as it is. A key already in the file is updated in place, so a rerun never adds a second copy. Later copies of a key are dropped: the last one would win when the file is read. A new file starts with header.