titletext | description |
---|---|
Use environment variables to store API Keys and secrets |
Use environment variables to expose custom settings, keys, or other secrets to your app during the build, without committing them to your repository.
|
Environment variables allow you to specify API keys, access tokens, or other secrets that your build requires, without having them checked into your repository.
Environment variables are made available during a build to any process that can use them, including custom build steps.
You can create regular environment variables which are available to all branches, or branch-specific environment variables which are only available for a specific branch.
{% include "/_common/important-environment_variable_scope.adoc" %}
Start by clicking on App Settings.
In the left navigation, select Build settings, then the Environment tab.
In the Environment variables row, click Configure.
Enter a name and value to create a default environment variable. Your environment variable is now ready to be consumed by your app at build time.
You can also create environment variables for a specific branch by creating a branch-specific override.
Under Override build configuration, click Add a branch and select the branch you would like to create an environment variable for.
Select Environment variables from the dropdown and click Configure.
Enter a name and value to create your branch-specific environment variable.
Your environment variables will be automatically consumed by tools that are expecting them.
If you would like to access them in your custom build scripts, use the bash variable expansion syntax.
./Example.framework/run $Crashlytics_Token
That’s it! If you want to consume your variables from within your app, follow the Device Variables guide.