[IGN-14256] Deployment Mode

Hi everyone,

is there any way to detect via Tag or Script, in which deployment mode my gateway is running?
I saw, that I can request this via the openApi and the /gateway-info endpoint.

For me it would be great if there is a Tag or a system function.

Thanks for helping.

At the moment no, but if you can get yourself a GatewayContext then you can get the ConfigurationManager and call ConfigurationManager::getActiveMode(): ConfigurationManager

To add on to Kevin's explanation. In a Gateway context the following script should get you what you are looking for:

	from com.inductiveautomation.ignition.gateway import IgnitionGateway

	context = IgnitionGateway.get()
	mode = context.getConfigurationManager().getActiveMode()
	if mode.isEmpty():
		print('core')
	else:
		print(mode.get())

A system tag would be useful and a ticket has been created to add one.

Garth

1 Like

If you use my Integration Toolkit, this one-liner will do:

print system.util.toolkitCtx().configurationManager.activeMode.getOrElse(None)

:grin:

Fix with better understanding of an empty mode.

Neither of these examples should "or else" to "core" - it's just no deployment mode.

Hmmm. Please elaborate, because I am now confused.

By default you're just not in a named deployment mode.

Meaning there's just no folder of config overrides to consider? That is, "no mode" => ordinary config, while mode "something" => ordinary config + "something" overrides?

Edited to elide misuse of "core".

Modes and resource collections are a little muddled. When you are not in an explicitly defined/named mode, then the standard core, local, system, and platform collections are considered with nothing overriding them. But these are explicitly not named modes, they are resource collections.

Right, but don't those collections still apply normally in a named mode for any config that isn't present in the named mode?

Yes

1 Like

Thanks for your help.

If I need different custom config files for each mode, where should i save the config files?
Is it a good way to save them in the config/ressources/:MODE_NAME/ folder