Smile CDR v2024.05.PRE
On this page:

39.5.1Environment

 

The Environment object has utility methods.

39.5.2Method: getProperty(name)

 

This method retrieves a system property from the environment. It can be used to pass credentials or other important details in to the script from outside of Smile CDR.

Inputs:

  • name – The name of the system property. Note that the name must begin with either the string js. or the string js_ in order to ensure that unintended properties do not leak into the scripting environment.

Outputs:

  • This method returns the property value, or null if none exists.

Example:

If the setenv script contains the following declaration:

JVMARGS="$JVMARGS -Djs.authkey=12345"

Or, an External File Property Source is configured with the following property:

js.authkey=12345

The following script fragment may be used to retrieve this property:

var authKey = Environment.getProperty('js.authkey');

39.5.3Method: getEnv(name)

 

This method retrieves an environment variable from the host server environment. It can be used to pass credentials or other important details in to the script from outside of Smile CDR.

Inputs:

  • name – The name of the environment variable. Note that the name must begin with either the string js. or the string js_ in order to ensure that unintended properties do not leak into the scripting environment.

Outputs:

  • This method returns the property value, or null if none exists.

Example:

If the host server environment contains the following environment variable:

export JS_MYENVKEY=JS_MYENVVALUE

The following script fragment may be used to retrieve the environment variable value JS_MYENVVALUE:

var myEnvValue = Environment.getEnv('JS_MYENVKEY');