About predefined environment variables in XM Cloud

Last week, I wrote a blog post about toggling item clone, which was a custom setting in my XMC environment. This blog post could seem similar to that one so, in case if you want to skip, this is the right point. Anyway, this week, I encountered something more common and expected it to work a certain way and it was not the case. So, I felt it needs a blog note. Here is a diagrammatic representation of the contents of this blog post:

Without any more its and bits, the context here is to access PowerShell ISE in the XM Cloud world. A few days back, I remember accessing it in my local Docker setup by -

1. Adding a .env file variable with name and value as follows:

SITECORE_SPE_ELEVATION = Allow

2. Then, in my docker compose yml, within the cm instance, I added an entry as follows: 


With the usual ritual of executing the up.ps1, my local instance was running. Next, through the  PowerShell ISE tile from desktop, I could execute the default SPE query without getting prompted for user credentials. So, this is all good based on definition of different values for SITECORE_SPE_ELEVATION:


Now, my next expectation and that proved me wrong: in XMC Deploy app set the SITECORE_SPE_ELEVATION environment variable value to Allow, restart the environment and then see the change in the environment at once. 

No, this is not the way it works. Instead, you need to create a separate patch config and deploy that. This patch is what takes effect for the variable in the XMC environment as specified in this Sitecore Stackexchange answer.

Note that just in case if your showconfig.aspx doesn't reflect the XMC deploy app environment variable change even after environment restart, make the env variable edit first in the XMC deploy app and click the Build and deploy option in the XMC deploy app menu.

So, in case if you are trying to setup environment variables, in the XMC world, you need to address it by setting up for:

1. Local Docker instance
2. XMC Environment

How to expose GraphQL playground for your Sitecore XM Cloud environment?

I confirmed the same with another env variable related to exposing the environment' GraphQL playground, which is another boolean value setting specified here in the documentation.

So, here is the run-down:

Originally, my local instance'  GraphQL IDE was inaccessible:


When I checked my local showconfig.aspx, this is how it looked at this point:



After the usual process of adding a variable in .env file, an environment entry in docker compose file and a start up of the local Docker instance,


This is how my local setup showconfig.aspx looked now:



Now, my local setup' GraphQL playground was accessible too:


On the other hand, to get this picked by the XMC environment, I had to create a patch config (in some zzz folder) and deploy it to the environment. 

My patch config:

*******
*******

With that patch deployed to the environment, you should be able to access the environment' GraphQL playground.

Last but not least, the above approach is probably applicable for all the predefined environment variables specified in the Sitecore XMC documentation:

SITECORE_SPE_ELEVATION 

Sitecore_GraphQL_ExposePlayground 

PAGES_PERSONALIZE_SCOPE 

PAGES_ENABLE_NEW_RTE_EDITOR 

Comments