Documentation ¶
Overview ¶
Package ffenv provides an .env config file parser.
Index ¶
Constants ¶
This section is empty.
Variables ¶
var ErrInvalidLine = errors.New("invalid line")
ErrInvalidLine is returned when the parser encounters an invalid line.
Functions ¶
func Parse ¶
Parse is a parser for .env files. Each line is tokenized on the first `=` character. The first token is interpreted as the env var representation of the flag name, and the second token is interpreted as the value. Both tokens are trimmed of leading and trailing whitespace. If the value is "double quoted", control characters like `\n` are expanded. Lines beginning with `#` are interpreted as comments. End-of-line comments are not supported.
The parser respects the [ff.WithEnvVarPrefix] option. For example, if parse is called with an env var prefix MYPROG, then both FOO=bar and MYPROG_FOO=bar would set a flag named foo.
Types ¶
This section is empty.