Cloud Manager Environment Variables 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 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 add-variables
-
Log into Adobe Cloud Manager at my.cloudmanager.adobe.com.
-
On the My Programs screen, select the one you want 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.
- If you are adding an environment variable for the first time, you can see an Add Configuration button in the center of the page. You can use this button or Add to open the Environment Configuration dialog.
-
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
-
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.
-
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. After completion, the new environment variable is visible in the table.
Updating Environment Variables update-variables
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 want 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 want to modify, select Edit or Delete.
-
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.
-
After you have made 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. After completion, the updated environment variables are visible in the table.
Using Environment Variables using
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 availability
Environment variables can be used in several places.
Author, Preview, and Publish author-preview-publish
Both regular environment variables and secrets can be used in the authoring, preview, and publishing environments.
Dispatcher dispatcher
Only regular environment variables can be used with the dispatcher. Secrets cannot be used.
However environment variables cannot be used in IfDefine
directives.
OSGi Configurations osgi
Both regular environment variables and secrets can be used in OSGi configurations.
Pipeline Variables pipeline
In addition to environment variables, there are also pipeline variables, which are exposed during the build phase. Learn more about pipeline variables here.