Currently it's not possible to specify Secure gateway for dynamic folders. You can only make connection objects inherit Secure gateway settings from parent folder. But this doesn't really help since you can't specify it for dynamic folders.
you are right, you can't assign a secure gateway to the dynamic folder but you can configure the secure gateway (which can be either created dynamically or statically in a separate doc) on the dynamic connections inside your dynamic folder using the script. You can actually access all the properties of each object in the script
In the documentation (https://www.royalapplications.com/go/kb-all-royaljson) PDF, search for "Advanced Scenarios"). You can find all available properties of each connection here: https://content.royalapplications.com/Help/RoyalTS/V5/index.html?scripting_objectproperties_royalrdsconnection.htm
Let me know if this helps.
Yes it could be done in that way, but it would be nice to keep code as generic as possible. For example now I'm creating connection objects which inherit credentials from parent folder. Which is really nice since i don't have to customize code for every time when i need to import new set of connection objects or change credentials in imported objects.
Of course as a work-a-round i could check if custom property called "SecureGateway" is set, if it is; use it.
But to be consistent with normal folders and how credentials are working, this would be nice to have.
to be honest, adding this option may be even more confusing. The credentials of a dynamic folder do work differently because these credentials are intended to be used in the script to authenticate to the backend system - not for the connections created by the script. I personally think that letting the script configure the secure gateway options for each connections is the better approach as the sole connection configuration is controlled by the script and not by configuration "outside" of the script.