Documentation ¶
Overview ¶
Package envfile provides tools to read and load environment variables from files.
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func Generate ¶ added in v0.4.4
Generate encodes and writes an env file in dir based on the provided src. It is meant to be used with go generate to create .env files based on the project's config(s).
func Overload ¶
Overload reads from filename and sets and overwrites the environment variables using env.Overload.
func OverloadFS ¶
OverloadFS reads from filename and sets and overwrites the environment variables using env.Overload.
Types ¶
type Encoder ¶
type Encoder struct {
// contains filtered or unexported fields
}
Encoder embeds an env.Encoder and sets its target io.Writer to an os.File.
func Create ¶
Create returns a new Encoder which creates the file filename and uses it to write the encoded values to.
func NewEncoder ¶
NewEncoder returns a new Encoder which writes the encoded values to the provided os.File f.
type Reader ¶
type Reader struct {
// contains filtered or unexported fields
}
func NewReader ¶
NewReader returns a Reader which looks up environment variables from the provided fs.File.
dec := env.NewDecoder(envfile.NewReader(file))
func Open ¶
Open opens filename for reading using os.Open and returns a new *Reader. It is the caller's responsibility to close the Reader when finished. If there is an error, it will be of type *os.PathError.