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.
At the moment no, but if you can get yourself a GatewayContext then you can get the ConfigurationManager and call ConfigurationManager::getActiveMode(): ConfigurationManager
Meaning there's just no folder of config overrides to consider? That is, "no mode" => ordinary config, while mode "something" => ordinary config + "something" overrides?
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.
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