Expand description
Loads environment variables from .env files.
§Quick start
ⓘ
dotenv::load();Call load near the start of your program to load a .env file
from the current working directory.
§Precedence
- Existing environment variables are never overwritten. A variable
already set in the environment takes priority over anything in
.env. - First declaration wins in
.env. If the same key appears multiple times, only the first is used.
§Supported syntax
HELLO=world
HELLO="world"
HELLO='world'
HELLO='"nested"'
HELLO=world # inline comment
# full-line comment§Key names
Keys may only contain ASCII letters, digits, _, ., and -.
§Limitations
- Multi-line values are not supported.
- Variable substitution (e.g.
${FOO}) is not supported. - Export syntax (
export KEY=value) is not supported.
Structs§
- Parse
Error - A parse error with the line number and kind.
Enums§
- Error
- Errors that can occur when loading a
.envfile. - Parse
Error Kind - The specific kind of parse error.
Functions§
- load
- Loads the
.envfile from the current working directory.