<commit_before>---
title: Using environment variables with EAS Update
---

EAS Build and EAS Update allow setting and getting environment variables at different times. There are multiple steps to ensure the proper environment variables are available when developing, building, and publishing an update to a project.

## Setting up the app config

To expose environment variables in our project, we'll have to set up our app config to allow it. After this, we'll be able to access these variables throughout our entire project.

First, we'll need to rename **app.json** to **app.config.js**, which will allow us to export our app's config, including JavaScript variables.

Next, we'll add an `API_URL` environment variable to our project.

To add it to our app config, we'll add it under the `extra.eas` property.

**app.config.js**

```js
export default () => ({
  expo: {
    extra: {
      eas: {
        API_URL: process.env.API_URL || null,
      },
    },
    // ...
  },
});
```

The code above sets the `extra.eas` property. Now, we need to set and get the variable in our project.

## Setting and getting environment variables during development<commit_msg>adds note about babel plgin (#15966)<commit_after>---
title: Using environment variables with EAS Update
---

> ⚠️ The APIs below are not stable and are expected to change as we develop EAS Update. An alternate solution is to use a babel plugin to transform variables into environment variables, as described [here](/guides/environment-variables/#using-babel-to-replace-variables).

EAS Build and EAS Update allow setting and getting environment variables at different times. There are multiple steps to ensure the proper environment variables are available when developing, building, and publishing an update to a project.

## Setting up the app config

To expose environment variables in our project, we'll have to set up our app config to allow it. After this, we'll be able to access these variables throughout our entire project.

First, we'll need to rename **app.json** to **app.config.js**, which will allow us to export our app's config, including JavaScript variables.

Next, we'll add an `API_URL` environment variable to our project.

To add it to our app config, we'll add it under the `extra.eas` property.

**app.config.js**

```js
export default () => ({
  expo: {
    extra: {
      eas: {
        API_URL: process.env.API_URL || null,
      },
    },
    // ...
  },
});
```

The code above sets the `extra.eas` property. Now, we need to set and get the variable in our project.

## Setting and getting environment variables during development
{'fraction_non_alphanumeric': 0.08606245239908607, 'fraction_numerical': 0.001904036557501904, 'mean_word_length': 3.7333333333333334, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 6, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '125694', 'n_tokens_mistral': 698, 'n_tokens_neox': 671, 'n_words': 359}