Documentation ¶
Overview ¶
Package gotenv implements reading dotenv files and setting env variables based on their content.
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
Types ¶
type EnvVar ¶ added in v0.4.0
type EnvVar struct {
Key, Val string
}
func Read ¶ added in v0.4.0
Read reads dotenv files.
Files should contain variable definitions in a form `KEY=VALUE`. Whitespaces at the beginning of the line and around equal sign `=` are allowed and ignored. If the value is surrounded by the single `'` or double `"` quotes, it will be passed to the env unquoted. No value after equal sign means that the variable will be reset to empty. Hash sign `#` acts as a comment, ignoring everything until the end of line, unless it's within quotes. If there are multiple definitions for the same KEY, in a single file or spanning multiple files, the last definition wins.
If there is no given file, `.env` is assumed.