# Environment Variables

The **Environment Variables** tab within the **Settings** section allows you to define custom variables that are automatically injected into your application’s environment during **builds** and **CodePush** operations. This enables secure and flexible configuration management without hardcoding sensitive values directly into your source code.

<figure><img src="/files/MV3k2vwwSF2iJXuI3HnR" alt=""><figcaption></figcaption></figure>

## <mark style="color:red;">What Are Environment Variables?</mark>

Environment variables are key-value pairs used to pass dynamic configuration data to your application at build time. These values can be used to:

* Manage API keys and tokens securely
* Define environment-specific behaviors (e.g., production vs. staging)

They are not stored permanently inside your app, ensuring better security for sensitive data.

## <mark style="color:red;">Example Use Case</mark>

Let’s say your mobile application sends error logs to **Sentry**, and you want the corresponding **map files** to be uploaded during the build process. To do this, the system needs to authenticate with **Sentry’s API**, which requires an **authentication token**.

Because this token is only required during the build process and poses a security risk if stored permanently, it’s ideal to set it as a temporary environment variable. You can define this token as an environment variable in App Maker, ensuring it's available only during the build or CodePush phase.

## <mark style="color:red;">**Adding a New Environment Variable**</mark>

To add a new environment variable:

1. Navigate to the **Environment Variables** tab in your project's settings.
2. Click **"+ Add Environment Variable"**.
3. Fill out the form fields as described below:

<figure><img src="/files/XsyyBatgr1BnK57fabtT" alt="" width="563"><figcaption></figcaption></figure>

#### <mark style="color:red;">Name</mark>

* The **name** of the variable must be written in **uppercase** letters.
* Only **letters**, **numbers**, and **underscores (`_`)** are allowed.

*Valid Examples:*

```bash
USERNAME=johndoe@example.com
USER_TOKEN=token_123
```

*Invalid Examples:*

```
username=johndoe@example.com
user-token=token
```

[📘 Learn more about environment variable naming conventions](https://en.wikipedia.org/wiki/Environment_variable)

#### <mark style="color:red;">**Value**</mark>

* The **value** is always treated as a string, even if it represents a number, boolean, or JSON.
* Enter the value associated with the key you defined.

#### <mark style="color:red;">**Build Target**</mark>

You must assign each environment variable to a **build target**:

* **Production:** Used when deploying a live app to end users.
* **Staging:** Used in testing environments for pre-release validation.

{% hint style="info" %}
The correct set of variables will be automatically injected into the environment depending on the target selected during the **Build** or **CodePush** operation.
{% endhint %}

#### <mark style="color:red;">**Is Secret?**</mark>

If the **"Is Secret?"** option is enabled:

* The variable’s value will be hidden in the interface.
* Ideal for API tokens, passwords, and other sensitive data.
* Even after saving, secret values are not visible or retrievable through the UI for security reasons.


---

# Agent Instructions: Querying This Documentation

If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://docs.akinon.com/tutorials/app-maker/projects/settings/environment-variables.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
