> ## Documentation Index
> Fetch the complete documentation index at: https://bunnynet-cb9733c2-add-new-partner-apis.mintlify.site/llms.txt
> Use this file to discover all available pages before exploring further.

# Environment Variables

> Environment variables are used to store information or configuration data that your script requires at runtime.

Environment variables hold configuration data that your script reads at runtime. Because the values live outside the code, they never end up committed to your script or your version control system.

<Note>
  For sensitive data such as API keys, passwords, or tokens, use [environment
  secrets](/scripting/secrets) instead. Secrets are encrypted and cannot be
  viewed once set.
</Note>

## Adding environment variables

To add a variable to your script:

1. Log in to the [bunny.net dashboard](https://dash.bunny.net/auth/login?pk_buttonlocation=menu).
2. Select **Edge Platform**, click on **Scripting**, and select the script.

<img src="https://mintcdn.com/bunnynet-cb9733c2-add-new-partner-apis/skVYlD6SY4HxvcnU/images/docs/b2cf84a71bbd1c6af9b87f320055e681a16782c609a7b192d5279319b79f843c-image.png?fit=max&auto=format&n=skVYlD6SY4HxvcnU&q=85&s=15635215c84a966c960c4c3bb03747ce" alt="" width="2310" height="1400" data-path="images/docs/b2cf84a71bbd1c6af9b87f320055e681a16782c609a7b192d5279319b79f843c-image.png" />

3. Select **Env Configuration** and **Environment Variables**, and fill in the details of the variable you want to create.

<img src="https://mintcdn.com/bunnynet-cb9733c2-add-new-partner-apis/skVYlD6SY4HxvcnU/images/docs/6890047328f8c5e9d652f9405138062ff8e04f515d719b8cd8d8cccdc9ad0db2-image.png?fit=max&auto=format&n=skVYlD6SY4HxvcnU&q=85&s=a4023ec70755ee48f1c9fc92fc24fcde" alt="" width="1784" height="1394" data-path="images/docs/6890047328f8c5e9d652f9405138062ff8e04f515d719b8cd8d8cccdc9ad0db2-image.png" />

4. Click **Save**.

## Using environment variables

Read the value in your script with either the Node.js `process` module or `Deno.env`.

This example uses the `process` module:

```ts theme={null}
import * as BunnySDK from "@bunny.net/edgescript-sdk";
import process from "node:process";

BunnySDK.net.http.serve(
  async (request: Request): Response | Promise<Response> => {
    // Load environment variable named OriginUrl
    const originUrl = process.env.OriginUrl;

    // Parse initial url
    const url = new URL(request.url);

    // Rewrite and fetch request from origin
    return fetch(originUrl + url.pathname);
  },
);
```

This one does the same thing with `Deno.env`:

```ts theme={null}
import * as BunnySDK from "@bunny.net/edgescript-sdk";

BunnySDK.net.http.serve(
  async (request: Request): Response | Promise<Response> => {
    // Load environment variable named OriginUrl
    const originUrl = Deno.env.get("OriginUrl");

    // Parse initial url
    const url = new URL(request.url);

    // Rewrite and fetch request from origin
    return fetch(originUrl + url.pathname);
  },
);
```
