getEnv()function
getEnv(name: string): string | undefined
| Param | Type | |
|---|---|---|
name | string | Name of the environment variable to read. required |
| Return | |
|---|---|
string | undefined | The variable's string value, or undefined if missing or unsupported. |
Get a process.env variable safely in all environments, or undefined if it doesn't exist or this environment does not support process.env (i.e. web environments).
Examples
getEnv("NODE_ENV") // "production"