Environment
Functions
getEnv()
function getEnv(importMetaDirname): Promise<void>;
Defined in: functions/env.ts:22
Helper function to get environment variables from a ".env" file that is located next to the
project's "package.json" file (i.e. at the root of the project repository) and inject them into
the process.env object.
Typically, once you have used this function, you would validate the process.env object with a
Zod schema. This function contains logic to convert environment variables that are empty strings
to undefined so that Zod default values can work correctly.
Under the hood, this uses the dotenv library to get the environment variables from the ".env"
file.
Parameters
| Parameter | Type | Description |
|---|---|---|
importMetaDirname | string | The value of import.meta.dirname (so that this function can find the package root). |
Returns
Promise<void>