> ## Documentation Index
> Fetch the complete documentation index at: https://bunnynet-cb9733c2-support-migration.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 are used to store information or configuration data that your script requires at runtime. They enable you to manage any values separate from the script code. This separation ensures that variable values are not exposed and stored in your scripts or version control systems but rather configured in the runtime.

<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 environment variables to your script, follow these steps:

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-support-migration/RpQ-CUm87OlkPU-U/images/docs/b2cf84a71bbd1c6af9b87f320055e681a16782c609a7b192d5279319b79f843c-image.png?fit=max&auto=format&n=RpQ-CUm87OlkPU-U&q=85&s=87f99b4ea780f91a1d9bdc368138e69c" 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-support-migration/RpQ-CUm87OlkPU-U/images/docs/6890047328f8c5e9d652f9405138062ff8e04f515d719b8cd8d8cccdc9ad0db2-image.png?fit=max&auto=format&n=RpQ-CUm87OlkPU-U&q=85&s=4f6c894bd290227099c285b1a91704df" alt="" width="1784" height="1394" data-path="images/docs/6890047328f8c5e9d652f9405138062ff8e04f515d719b8cd8d8cccdc9ad0db2-image.png" />

3. Click **Save**.

## Using environment variables

You can access environment variable value in the script code using node process module or using Deno.env.

The following script example shows how to access an environment variable value using node 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);
  },
);
```

The following script example shows script code with same logic but using Deno.env to access variable value:

```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);
  },
);
```
