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.
Environment variables offer a host of benefits to users of AEM as a Cloud Service:
Typical use cases for using environment variables include:
You must be a member of the Deployment Manager role in order to add or modify environment variables.
Log into Adobe Cloud Manager at my.cloudmanager.adobe.com.
Cloud Manager lists the various programs available. Select the one you wish to manage.
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.
Within the detail of the environment, select the Configuration tab then select Add to open the Environment Configuration dialog.
Enter the variable details.
After you enter your new variable, you must select Add in the last column of the row containing the new variable.
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.
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.
After you have created environment variables, you can update them using the Add/Update button to launch the Environment Configuration dialog.
Log into Adobe Cloud Manager at my.cloudmanager.adobe.com.
Cloud Manager lists the various programs available. Select the one you wish to manage.
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.
Within the detail of the environment, select the Configuration tab then select Add/update in the top right to open the Environment Configuration dialog.
Using the ellipsis button in the last column of the row of the variable you wish to modify, select Edit or Delete.
Edit the environment variable as necessary.
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.
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.
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 variables can be used in a number of places.
Both regular environment variables and secrets can be used in the authoring, preview, and publishing environments.
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.
You should validate your use of environment variables with the dispatcher locally before deploying.
Both regular environment variables and secrets can be used in OSGi configurations.
In addition to environment variables, there are also pipeline variables, which are exposed during the build phase. Learn more about pipeline variables here.