Using a JSON Configuration File
As an alternative to setting credentials in the model, you can specify them in a JSON document, the contents of which you assign to the executor_components parameter. The document should be in the following format:
{ "<component-id>": { "componentUrl": "<URL of component>", "dmpManagerUrl": "<URL of DMP manager, optional>", "clientId": "<clientId of DMP solution, optional>", "secret": "<secret of DMP solution, optional>", "bearerToken": "<DMP bearer token, optional>" } }
The "<component-id>" string is a key that you use to refer to the component in the JSON and has no other meaning. You can specify multiple components in the same JSON file so long as they have different "<component-id>" strings, e.g.:
{ "main": { "componentUrl": "https://vm65j75lqh-vm65j75lqh.dms.usw2.ficoanalyticcloud.com/", "dmpManagerUrl": "https://manager.dms.usw2.ficoanalyticcloud.com/", "clientId": "vm5qh0y37c", "secret": "wdS97u648BVoI#d3e4g2Z4mP780Y1DLdSDKm" }, "dev": { "componentUrl": "https://6tk0a8qheb-6tk0a8qheb.dms.usw2.ficoanalyticcloud.com/", "dmpManagerUrl": "https://manager.dms.usw2.ficoanalyticcloud.com/", "clientId": "vm5qh0y37c", "secret": "wdS97u648BVoI#d3e4g2Z4mP780Y1DLdSDKm" } }
The JSON document must always specify the componentUrl, and either the bearerToken or all of the dmpManagerUrl, clientId and secret values. If you do specify your own bearer token, be aware that it will eventually expire.
Then you can initialize an Executor in the model with the credentials from the JSON by calling the executorinit procedure. For example, if you save the above sample JSON in a file called "executors.json":
model InitExample uses "executor","mmsystem" declarations public jsoncfg: text myexecutor: Executor end-declarations ! Load executors.json into a variable so it can be passed to a parameter fcopy("executors.json","text:jsoncfg") setparam("executor_components",string(jsoncfg)) ! Initialize myexecutor using the 'main' set of credentials executorinit(myexecutor, "main") if myexecutor.status<>EXECUTOR_OK then writeln("Executor initialization error: ", myexecutor.lasterror) exit(1) end-if ! myexecutor now initialized and can be used end-model
The executor_components parameter is special in that it has a single value shared by all models within the Mosel instance - this means that if, for example, you set it for your master model, then the same value will be used for all submodels that you start in the same Mosel process.