Cloud Manager Environment Variables

Standard environment variables can be configured and managed via Cloud Manager. They are provided to the run time environment and can be used in OSGi configurations. Environment variables can be either environment-specific values or environment secrets, based on what is being changed.

Overview

Environment variables offer a host of benefits to users of AEM as a Cloud Service:

  • They allow the behavior of your code and application to vary based on context and environment. For example, they can used to enable different configurations on the development environment compared to the production or stage environments to avoid costly mistakes.
  • They only need to be configured and setup once and can be updated and deleted when necessary.
  • Their values can be updated at any point in time and take effect immediately without the need for any code changes or deployments.
  • They can separate code from configuration and remove the need to include sensitive information in version control.
  • They improve the security of the AEM as a Cloud Service application since they live outside of the code.

Typical use cases for using environment variables include:

  • Connecting your AEM application with different external endpoints
  • Using a reference when storing passwords instead of directly in the code base
  • When multiple development environments exist in a program and some configuration differs from one environment to the next

Adding Environment Variables

NOTE

You must be a member of the Deployment Manager role in order to add or modify environment variables.

  1. Log into Adobe Cloud Manager at my.cloudmanager.adobe.com.

  2. Cloud Manager lists the various programs available. Select the one you wish to manage.

  3. Select the Environments tab for the chosen program then select the environment for which you want to create an environment variable in the left navigation panel.

  4. Within the detail of the environment, select the Configuration tab then select Add to open the Environment Configuration dialog.

    • If you’re adding an environment variable for the first time, you will see an Add Configuration button in the center of the page. You can use this button or Add to open the Environment Configuration dialog.

    Configuration tab

  5. Enter the variable details.

    • Name
    • Value
    • Service Appplied - Defines for which service (Author/Publish/Preview) the variable applies or if it applies to all services
    • Type - Defines if the variable is normal variable or a secret

    Adding a variable

  6. After you enter your new variable, you must select Add in the last column of the row containing the new variable.

    • You can enter multiple variables at once by entering a new line and selecting Add.

    Save variables

  7. Select Save to persist your variables.

An indicator with the status Updating is shown at the top of the table and next to the newly added variable to indicate that the environment is being updated with the configuration. Once complete, the new environment variable will be visible in the table.

Updating variables

TIP

If you wish to add multiple variables, it is recommended to add the first variable, then use the Add button in the Environment Configuration dialog to add the additional variables. This way you can add them with one update to the environment.

Updating Environment Variables

After you have created environment variables, you can update them using the Add/Update button to launch the Environment Configuration dialog.

  1. Log into Adobe Cloud Manager at my.cloudmanager.adobe.com.

  2. Cloud Manager lists the various programs available. Select the one you wish to manage.

  3. Select the Environments tab for the chosen program then select the environment for which you want to create an environment variable in the left navigation panel.

  4. Within the detail of the environment, select the Configuration tab then select Add/update in the top right to open the Environment Configuration dialog.

    Add/Update button for variables

  5. Using the ellipsis button in the last column of the row of the variable you wish to modify, select Edit or Delete.

    Edit or delete variable

  6. Edit the environment variable as necessary.

    • When editing, the ellipsis button will change to options to revert back to the original value or confirm your change.
    • When editing secrets, the values can only be updated, not viewed.

    Edit variable

  7. Once you’ve made all of the required configuration changes, select Save.

As when adding variables, an indicator with the status Updating is shown at the top of the table and next to the newly updated variable(s) to indicate that the environment is being updated with the configuration. Once complete, the updated environment variable(s) will be visible in the table.

TIP

If you wish to update multiple variables, it is recommended to use the Environment Configuration dialog to update all of the necessary variables at once before tapping or clicking Save. This way you can add them with one update to the environment.

Using Environment Variables

Environment variables can make your pom.xml configurations more secure and flexible. For example, passwords needn’t be hard coded and your configuration can adapt based on the values in environment variables.

You can access environment variables and secrets via XML as follows.

  • ${env.VARIABLE_NAME}

See the document Setting Up Project for an example of how to use both types of variables in a pom.xml file.

See the official Maven documentation for more details.

Environment Variable Availability

Environment variables can be used in a number of places.

Author, Preview, and Publish

Both regular environment variables and secrets can be used in the authoring, preview, and publishing environments.

Dispatcher

Only regular environment variables can be used with the dispatcher. Secrets can not be used.

However environment variables can not be used in IfDefine directives.

TIP

You should validate your use of environment variables with the dispatcher locally before deploying.

OSGi Configurations

Both regular environment variables and secrets can be used in OSGi configurations.

Pipeline Variables

In addition to environment variables, there are also pipeline variables, which are exposed during the build phase. Learn more about pipeline variables here.

On this page