> ## Documentation Index
> Fetch the complete documentation index at: https://waterfall.supafetch.com/llms.txt
> Use this file to discover all available pages before exploring further.

# .env file

> Envirnment configuration options

# Environment Variables

All of these are optional and getHtml will work without them all.
If you wish to use a remote headless browser service then simply include the API Key and all puppeteer requests will connect to this service.
Only *BROWSERLESS* is currently supported.

```text theme={null}
HEADLESS  // Optional
NODE_ENV  // Optional
BROWSERLESS_API_KEY  // Optional
BROWSERBASE_API_KEY  // Optional //unsupported
BROWSER_SERVICE  // Optional
```

## Configuration

There are 3 levels of switches for headless mode:

1. `NODE_ENV` environment variable (overrides all, if the `NODE_ENV` is "production" this overrides all including the headless param in the options & the `HEADLESS` env )
2. `HEADLESS` environment variable (if `NODE_ENV` is not "production", `HEADLESS` env var set to "off" overrides the `headless` options param.)
3. `headless` options param value (default `true`) can be set to `false` object passed to getHtml

This logic has specifically been designed to make sure you do not leave headless mode off in production!
When testing/debugging locally I change ONLY the `HEADLESS` param and do not change the `headless` options param.

```text theme={null}
HEADLESS="off";
```

```typescript theme={null}
//(headless=true) optional param passed in the options
const IS_PRODUCTION = NODE_ENV === "production";
const SHOW_PUPPETEER = HEADLESS === "off" ? false : headless;

headless: IS_PRODUCTION ? true : SHOW_PUPPETEER,
```

To configure Waterfall-Fetch, you can set the following environment variables:

<ParamField body="BROWSER_SERVICE" type="string" required="false">
  The headless browser service to use (e.g., 'browserless' or 'browserbase')
</ParamField>

<ParamField body="BROWSERBASE_API_KEY" type="string">
  Your Browserbase API key (currently NOT used)
</ParamField>

<ParamField body="BROWSERLESS_API_KEY" type="string">
  Your Browserless API key
</ParamField>

<ParamField body="NODE_ENV" type="string">
  Set to 'production' for production environments
</ParamField>

<ParamField body="HEADLESS" type="string">
  Set to String 'on' or 'off' to control headless mode
</ParamField>

For more advanced usage and configuration options, check out our [API Reference](/mdx/api-reference/gethtml).
