Menu

AEM Environment Variables | AEM as Cloud Service

The Adobe I/O CLI plays an integral role in development on AEM as a Cloud Service as it provides developers the ability to manage Cloud Manager environment & pipeline variables from the CLI

Pipeline Variables

Your build process may depend upon specific configuration variables which would be inappropriate to place in the git repository or you may need to vary them between pipeline executions using the same branch.

Cloud Manager allows for these variables to be configured through the Cloud Manager API or Cloud Manager CLI on a per-pipeline basis. Variables may be stored as either plain text or encrypted at rest. In either case, variables are made available inside the build environment as an environment variable which can then be referenced from inside the pom.xml file or other build scripts.

Uses example

  • Used to vary behavior of build process
  • Accessible inside the build process
  • Dev minification is set differently on Dev vs Stage or Prod
  • Disable caching on Dev

Standard Environment Variables

Changing application behavior based on standard environment variables

Uses example:

  • Provided to the runtime environment
  • Used in OSGi configuration
  • Store passwords outside of version control, instead use a reference.
  • Connect your AEM application with different external endpoints

Types of environment variables

  1. Inline values. e.g. { "keyName" : "jorvee" }
  2. Environment specific values. e.g. { "endpoint" : "$[env:JORVEE_ENDPOINT]" }
  3. Environment secrets. e.g. { "authToken" : "$[secret:J_AUTH_TOKEN]" }


Variable naming conventions

  • Variable names must observe the following conventions.
  • Variables may only contain alphanumeric characters and the underscore (_).
  • The names should be all upper-case.
  • There is a limit of 200 variables per pipeline.
  • Each name must be less than 100 characters.
  • Each string variable value must be less than 2048 characters.
  • Each secretString type variable value must be less than 500 characters.

References:

How to install .FAR file in AEM

DOT FAR file is the Sling Feature Archive file, that work as a AEM package but we cant upload and install .far file using AEM package manager. To install the .far file in AEM we have to follow the following steps.

Steps to Install .far file in AEM

  1. Go to aem-quickstart folder. If you are setting the new aem then quickstart folder you will get once you unzip the aem jar file or run the jar file first time.
  2. Create a folder with name "install" under crx-quickstart.
  3. Add .far file into install folder.
  4. Now run the AEM jar again. If AEM is running first stop and then start again.

How to turn off form autocompletion using HTML

All modern browsers remember user's information that the user submits through HTML input fields on any websites. This helps users not to remember the information, or enables the browser to offer auto completion or auto fill.

Enable autocomplete or autofill


By default this is enable in all browsers. If not then you can explicitly allow autocomplete or at the time of development you can also set autocomplete on or off for the whole form of any particular field of the form using attribute autocomplete.

Possible values for autocomplete:

For a input type text : autocomplete="on"

Disable autocomplete


You can disable autocomplete by setting the autocomplete to off or false.

e.g.

<input type="text" autocomplete="off" />




In modern browsers autocomplete="off" not always works, specially we give consent to browser to store the login credential. In that case we can only prevent the autofill but not stop the autocomplete completely. For password fields we can set autocomplete="new_password" so that the login form will not prefilled even your credential will store on the browser's password manager.



References:

Turning off form autocompletion or autofill | Mozilla Developer

 

ERROR - This language feature is only supported for ECMASCRIPT6 mode or better: let declaration.

ECMAScript 2015 was the second major revision to JavaScript. ECMAScript 2015 is also known as ES6 and ECMAScript 6.

Issue:

ERROR - This language feature is only supported for ECMASCRIPT6 mode or better: let declaration.
 

Workaround:

The let keyword is not supported to declare a variable. Instead of let try using the var.

Service-Component entry can not be located in JAR: OSGI-INF

We might come to this issue while building the AEM code. The issue is with the @compoennt properties or the definition given for the file. In most of the cases error "Service-Component entry can not be located in JAR: OSGI-INF" says, that the @component name property which we are trying to give here is a duplicate and that name has been already given to a class, hence this name can not be accepted for a new component because it causes the unnecessary conflict between two components, and difficult to generate the meta-type or metadata, and manage the OSGi component.


[ERROR] Bundle com.rashid.aem.bundles:servlets:bundle:1.0.0-SNAPSHOT : Service-Component entry can not be located in JAR: OSGI-INF/com.rashid.aem.servlets.MobileAppImageServlet.xml~

[ERROR] Error(s) found in bundle configuration


Resolution

Update the name property value under @component annotation.


Example:

@Component( immediate = true,
service = Servlet.
class,
name =
"com.rashid.aem.servlets.GetAllImageServlet",
property = {
"sling.servlet.selectors=mobileapp",
"sling.servlet.extensions=json",
"sling.servlet.methods=GET",
"sling.servlet.paths=/bin/getAllImages"})