06-27-2024 03:09 AM
Hey,
I just wanted to know how you keep Environment-specific property files in Snaplogic?
Regards,
Sushant
07-01-2024 06:20 AM
I think the given answer from snaplogic would be to set it in your task parameters, but we found this to be quite risky since if something changes globally we need to identify and adjust each task affected.
In our setup we store environment data in expression files and access accounts, url:s and other settings via an expression like this
lib.[expression library name].[parameter group].[parameter]
Example of expression file for environment:
{
"variables": {
"API_HOST": "https://server.com:12345/rest/execute",
"SOAP_HOST":"https://server2.com:42321/ws",
"SMBAccount": "../../shared/SMB Sample TEST",
"RESTAccount": "../../shared/Rest account test",
"NumberVariable": 123,
"TextVariable": "abc123"
}
}
In your pipeline parameters you point to the expression files you wish to use.
you can have global environment parameter files in the /shared or you can have them in your project and mix both if needed.
Example of a pipeline in a project which loads two expression files, one global and one for the specific project:
And you can use these in your snaps and pipeline executes, wherever you can use expressions:
This example would get the value from variables.NumberVariable in the file imported as config
lib.config.variables.NumberVariable
Expression files are a bit tedious to work with since all changes needs to be done by downloading the file, editing and uploading it again.
You can combine, extend or use this type of functionality in many different ways, this is one suggestion which we have tried.
I would wish there were alternatives which were more native in snaplogic for handling environment variables.