简体   繁体   English

如何在脚本中获取 Mirth Connect 环境名称?

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

I'm running Mirth Connect Server 3.8.1.我正在运行 Mirth Connect Server 3.8.1。 The settings page has two fields, Environment Name and Server Name:设置页面有两个字段,环境名称和服务器名称:

在此处输入图像描述

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?如何获得这个领域?

This should work.这应该有效。

var serverSettings = configurationController.getServerSettings();
var environmentName = serverSettings.getEnvironmentName();

The serverSettings object also has the server name available among other settings. serverSettings 对象还有其他设置中可用的服务器名称。 See source here: https://github.com/nextgenhealthcare/connect/blob/3.8.x/server/src/com/mirth/connect/model/ServerSettings.java请参阅此处的来源: https : //github.com/nextgenhealthcare/connect/blob/3.8.x/server/src/com/mirth/connect/model/ServerSettings.java

For folks finding this thread, here's a function that returns the Mirth environment name.对于找到这个线程的人,这里有一个返回 Mirth 环境名称的函数。

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

} }

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM