How do I get the Mirth Connect Environment Name in a script?

Viewed 455

I'm running Mirth Connect Server 3.8.1. The settings page has two fields, Environment Name and Server Name:

enter image description here

I've been able to get the Server Name in a script the following way:

var configurationController = Packages.com.mirth.connect.server.controllers.ConfigurationController.getInstance();
var serverName = configurationController.getServerName();

But I have not been able to get the Environment Name. The obvious guess that didn't work and only resulted in an error was:

var environmentName = configurationController.getEnvironmentName();

How to get this field?

2 Answers

For folks finding this thread, here's a function that returns the Mirth environment name.

function getEnvironmentName () {
var configurationController = Packages.com.mirth.connect.server.controllers.ConfigurationController.getInstance();
var serverSettings = configurationController.getServerSettings();
var environmentName = serverSettings.getEnvironmentName();
return environmentName;

}

Related