Environment variables

In the XM Cloud Deploy app, you can manage settings that apply to an individual XM Cloud environment by creating environment variables in the XM Cloud Deploy app.

Environment variables are key-value pairs created outside your XM Cloud environment source code so that each value can change depending on the environment. When you create an environment variable, it is available for reference in your XM Cloud environment source code.

Environment variables simplify configuration changes because you do not have to modify source code.

For example, in your XM Cloud production environment, you can create environment variables with production API URLs and authentication keys to connect to your production product catalog in OrderCloud. While in your XM Cloud staging environment, you can change the values of the environment variables to connect to your staging product catalog instead.

You can also use the Sitecore Command Line Interface (CLI) with the XM Cloud plugins to create, update , and delete environment variables.

XM Cloud environments come with the following predefined environment variables:

XM Cloud environments also support other special variables:

SITECORE_SPE_ELEVATION

The SITECORE_SPE_ELEVATION environment variable specifies how the system responds to your attempts at using the SPE module for activities such as running Powershell scripts inside your XM Cloud instance.

For security purposes, the default value of the session elevation action value for SPE is Blocked. Therefore, the following applications and activities are blocked:

By changing the value of the SITECORE_SPE_ELEVATION environment variable, you override the default blocking behavior when you want to elevate the permissions to complete an otherwise blocked task.

The available values are:

Value

Description

Block

Default value. Always blocks the session from running elevated without prompting the user for permission.

Confirm

Prompts the user for a confirmation before running the session elevated.

Allow

Always allow the session to run without prompting the user for permission.

Danger

Only set the SITECORE_SPE_ELEVATION value to Allow for a local environment.

Note

The values are case-sensitive.

Sitecore_GraphQL_ExposePlayground

When using the Sitecore Authoring and Management GraphQL API, you can expose the GraphQL playground with the help of the Sitecore_GraphQL_ExposePlayground environment variable. The GraphQL playground is disabled by default. You must enable and authorize the Authoring and Management API GraphQL playground before you can use it.

LOG_LEVEL_VALUE

You can use this variable to set a log level for the general log, which you can access in the Deploy app in the Projects tab by selecting the relevant project, then the environment.

Environment logs in the XM Cloud Deploy app

The available values, in descending order of detail, are:

Value

Description

ALL

All available information.

DEBUG

Highly detailed event information.

INFO

Default value. General event information.

WARN

Potentially harmful or unsuccessful events.

ERROR

Error events.

FATAL

Fatal events.

OFF

No logging.

PUBLISHING_LOG_LEVEL_VALUE

You can use this variable to set a log level for the publishing process.

The available values, in descending order of detail, are:

Value

Description

ALL

All available information.

DEBUG

Highly detailed event information.

INFO

Default value. General information about the progression of the publishing process.

WARN

Potentially harmful or unsuccessful events.

ERROR

Error events.

FATAL

Fatal events that stop the publishing process.

OFF

No logging.

PAGES_PERSONALIZE_SCOPE

When you use XM Cloud Personalize, unique page identifiers are used to run personalization flows and analytics. In some cases, identical page identifiers might be created across different XM Cloud environments, for example, if pages are created through site serialization.

To isolate personalization data between such XM Cloud environments, use the PAGES_PERSONALIZE_SCOPE environment variable. It creates a unique identifier for a personalized page in the current environment.

If you don't use the variable, the default structure for identifying a page using Personalize is:

RequestResponse
embedded_{pageID}_{language}

After adding the PAGES_PERSONALIZE_SCOPE variable with a value of myEnv, for example, that ID is changed to:

RequestResponse
embedded_myEnv_{pageID}_{language}

Personalization and analytics are based on the page identifier. If you use this variable, we recommend that you apply it in the early stages of your implementation, and don't change the configuration.

Note

Only alphanumeric characters are allowed (letters and numbers). The value is case-sensitive.

PAGES_ENABLE_NEW_RTE_EDITOR

Before you begin
  • Your app must have JSS v21.5.2 or later.

Our new rich text editor, available within Rich Text components in Pages, offers several new features, including the ability to add tables, find and replace text, and style images in a variety of new ways.

To enable the new editor, create an environment variable named PAGES_ENABLE_NEW_RTE_EDITOR with any value, for example, TRUE. PAGES_ENABLE_NEW_RTE_EDITOR is a flag variable; regardless of its assigned value, it will enable the new editor. To go back to the old editor, delete the variable.

Do you have some feedback for us?

If you have suggestions for improving this article,