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.

What Are Environment Variables?

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.

Example Use Case

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.

Adding a New Environment Variable

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:

Name

  • The name of the variable must be written in uppercase letters.

  • Only letters, numbers, and underscores (_) are allowed.

Valid Examples:

[email protected]
USER_TOKEN=token_123

Invalid Examples:

[email protected]
user-token=token

📘 Learn more about environment variable naming conventions

Value

  • 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.

Build Target

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.

The correct set of variables will be automatically injected into the environment depending on the target selected during the Build or CodePush operation.

Is Secret?

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.

Last updated

Was this helpful?