Documentation
¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func Load ¶
Load loads env vars from multiple sources and sets them using os.Setenv.
Load will not overwrite vars by default, first to set wins. To make it override use SetOverride, when overriding, last to set wins.
Load will ignore if file do not exists by default, use SetRequireFileExists to force a file to exist.
Paths should be forward-slash separated, if no path is given ".env" will be used.
func LoadTesting ¶ added in v1.1.0
LoadTesting is like Load, but sets vars using [t.Setenv], useful for tests.
func Parse ¶
Parse reads every line from r, empty lines and lines that starts with '#' are discarded.
Value should not contain line breaks or quotes, all characters after the first equal sign up to the line break are considered. Values are not expanded.
func Read ¶ added in v1.1.0
Read is like Load, but returns a map instead of setting the environment. Predefined vars are only considered for expanding.
func SetOverride ¶
func SetOverride(value bool)
func SetRequireFileExists ¶
func SetRequireFileExists(value bool)
SetRequireFileExists makes Load and Read return an error if any of the given files do not exist.
Types ¶
This section is empty.