How to access information about current server/worker from within a flow

We want to be sure at any time that we are working in DEV or PROD environments.
We want to access some information about the server/worker we are running in.
we can access the IP of course but that’s not much use. Can we get the full server address or something similar?

 try {  
     InetAddress id = InetAddress.getLocalHost();  
     logWarn("the hostname is " + id.getHostName());  
   } catch (UnknownHostException e) {  
	logWarn("cannot get hostname");

Hi @kalimist , does this give you what you need?

1 Like

Thanks but ut does not give much more than the basic hostname/ip. I will look for envars instead

Hello @kalimist

this may or may not help. The way I find out where I am at programmatically is by using a java snippet and extract context properties node in a component. Basics below:

String computername = System.getenv("computername");	
String c_Folder = v_contextworkflowpath;
if (computername.toUpperCase().contains("#ServerName"))
	if (c_Folder.startsWith("/Live/"))
		out_workflow_environment = "Live";
	else if (c_Folder.startsWith("/Test/"))
		out_workflow_environment = "Test";
       out_workflow_environment = "Dev";

Note on my server I have a folder structure that has live flows in a folder named Live and a folder for testing on a server called Test. My AP is used for dev’ing.

I use this component to make decisions about what to do. e.g. Live use x database table, Test use y database table, Dev use z database table. or log here, or anything really.



This topic was automatically closed 7 days after the last reply. New replies are no longer allowed.