Put environment value into a context variable

Situation:

How can I put the environment value into a context var? We would like to use this variable in gateways and be able to set specific related variables?

 

Solution:

 

This is possible using the custom plugin. In this plugin you can read the environment property "Home.Environment.DisplayName" using the System.getProperty( ) method and then set this in context using context.put().

 

Below is an example custom plugin that can get the environment property "Home.Environment.DisplayName" using the System.getProperty( ) method from the server-configure.properties:

Object p = System.getProperty("Home.Environment.DisplayName");
String key = p.toString();
context.put("Environment",key);

 

You can also directly assign the value of the property "Home.Environment.DisplayName" into String like below:

String key = System.getProperty("Home.Environment.DisplayName");
context.put("Environment",key);
Have more questions? Submit a request

0 Comments

Article is closed for comments.