acs-aem-commons icon indicating copy to clipboard operation
acs-aem-commons copied to clipboard

AEM Environment Indicator shows same value for two environments (AEMaaCS)

Open gcalandria opened this issue 3 years ago • 2 comments

I'm working with AEM as a Cloud service with two environments. Dev and QA (both are develop environments) I've setup on each environment an environment variable: ENVIRONMENT_NAME For qa: ENVIRONMENT_NAME = QA For dev: ENVIRONMENT_NAME = DEV

I've setup a config under config.author.dev with the following values

{
  "browser-title-prefix":"$[env:ENVIRONMENT_NAME]-Author",
  "css-color":"green",
  "inner-html":"$[env:ENVIRONMENT_NAME]",
  "css-override":"#acs-commons-env-indicator {\r\n\tbackground-color: #1E8000;\r\n\tcolor: #FFF;\r\n\tposition: fixed;\r\n\ttop: 0;\r\n\tleft: 50%;\r\n\twidth: 60px;\r\n\tmargin-left: -63px;\r\n\theight: 30px;\r\n\tfont: bold 18px/29px sans-serif;\r\n\ttext-align: center;\r\n\tborder: solid 1px black;\r\n\tborder-top-width: 0;\r\n\tz-index: 100000000000000;\r\n}"
}

The problem I'm having is that in both DEV and QA environments I'm seeing DEV text. QA is not being shown for QA environment.

Am I doing something wrong?

gcalandria avatar Sep 22 '22 03:09 gcalandria

@gcalandria this looks right. You of course have to goto CM Configuration the "development environment" and set the ENVIRONMENT_NAME to DEV and then the same for the the QA environment's Configuration.

If you are seeing DEV in both, it sounds like your are setting that value in both environment Configuration. If you had $[env:ENVIRONMENT_NAME;default=DEV] .. then i would've guessed that you arent setting the variables correctly, but since you don't, and you're seeing a value (DEV) you must be setting the ENVIRONMENT_NAME variable to DEV on both environments. Any way you can post a screenshot of the set configuration variables for each env?

As you can see in the ACS Commons code for this [1] we dont set any default values for these, so that DEV value is coming from you/AEM as a Cloud Service.

[1] https://github.com/Adobe-Consulting-Services/acs-aem-commons/blob/master/bundle/src/main/java/com/adobe/acs/commons/wcm/impl/AemEnvironmentIndicatorFilter.java#L336-L344

davidjgonzalez avatar Sep 29 '22 12:09 davidjgonzalez

Hello @davidjgonzalez , I can't take a screenshot since we fix the problem creating another variable called ENVIRONMENT_COLOR and setting a different color for each environment and assigning it to css-color. And the other thing we did was to change the variable name from ENVIRONMENT_NAME to ENV_INDICATOR_TEXT. This has fixed the problem.. I see two possibilities here on why it failed 1 - We set by mistake a reserved name for a variable 2 - The variable ENVIRONMENT_NAME was created with Service Applied to Author and the other variables that we have created were Service Applied = All

GonzaloCalandria avatar Sep 29 '22 13:09 GonzaloCalandria

Hi GonzaloCalandria,

I can confirm that the corresponding java class provided by davidjgonzalez does not set the default value dev for the mentioned fields browser-title-prefix and inner-html. The only thing which I can think of is either some configuration mistake or name collusion with the environment variable ENVIRONMENT_NAME and it would be not something which can be fixed under the acs-aem-commons project. Nevertheless, it would be great, if you can reproduce the issue and provide some screenshots to give one more chance to evaluete. Otherwise, I would suggest closing the issue.

Cheers, Yunus

bayrakta avatar Nov 17 '22 16:11 bayrakta