Interface DotenvLoaderOptions

Hierarchy

  • DotenvLoaderOptions

Properties

envFilePath?: string | string[]

Path to the environment file(s) to be loaded.

expandVariables?: boolean

A boolean value indicating the use of expanded variables. If .env contains expanded variables, they'll only be parsed if this property is set to true.

Internally, dotenv-expand is used to expand variables.

ignoreEnvFile?: boolean

If "true", environment files (.env) will be ignored.

ignoreEnvVars?: boolean

If "true", predefined environment variables will not be validated.

keyTransformer?: ((key) => string)

Type declaration

    • (key): string
    • If set, this function will transform all environment variable keys prior to parsing.

      Be aware: If you transform multiple keys to the same value only one will remain!

      Parameters

      • key: string

        environment variable key

      Returns string

      Example

      .env file: `PORT=8080` and `keyTransformer: key => key.toLowerCase()` results in `{"port": 8080}`
      
separator?: string

If set, use the separator to parse environment variables to objects.

Example

app__port=8080
db__host=127.0.0.1
db__port=3000

if separator is set to __, environment variables above will be parsed as:

{
"app": {
"port": 8080
},
"db": {
"host": "127.0.0.1",
"port": 3000
}
}

Generated using TypeDoc