ffenv

package
v4.0.0-alpha.4 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Sep 20, 2023 License: Apache-2.0 Imports: 6 Imported by: 0

Documentation

Overview

Package ffenv provides an .env config file parser.

Index

Constants

This section is empty.

Variables

View Source
var ErrInvalidLine = errors.New("invalid line")

ErrInvalidLine is returned when the parser encounters an invalid line.

Functions

func Parse

func Parse(r io.Reader, set func(name, value string) error) error

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.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL