The setting of environment variables in the context of Aria Automation is very interesting. When the command printenv is entered in a terminal window, many fewer environment variables are displayed than when the same command is executed in an action.
var command = new Command("printenv");
command.execute(true);
var commandOutput = command.output;
System.log(commandOutput);
When I executed the above code, many environment variables were displayed that were specific to Aria Automation. Here a selection:
/**
* ABX_SERVICE_PORT
* ABX_SERVICE_SERVICE_HOST
* ORCHESTRATION_UI_PORT
* ORCHESTRATION_UI_SERVICE_HOST
* TENANT_MANAGEMENT_UI_PORT
* TENANT_MANAGEMENT_UI_SERCICE_HOST
* VCO_CONTROLCENTER_SERVICE_PORT
* VCO_CONTROLCENTER_SERVICE_SERVICE_HOST
* VCO_SERVICE_PORT
* VCO_SERVICE_SERVICE_HOST
*/
So I tested the following tiny snippet:
var VcoControlcenterServicePort = java.lang.System.getenv("VCO_CONTROLCENTER_SERVICE_PORT");
if (VcoControlcenterServicePort === null) {
System.log("VcoControlcenterServicePort not set");
} else {
System.log(VcoControlcenterServicePort);
}
It delivers in the context of Aria Automation a result, and in the context of a simulation null.
This seems to be a valid approach to differentiate whether a program is executed in the context of Aria Automation or not.
However, the question now would be how stable are these environment variables? I have tried this with the Aria Automation version 8.5.1. Has anyone already experience with this?