Dear Community, In my account, I would like to reference properties (for example, a hostname) using values stored in an external file. This file is stored in "shared". The goal is to make it easy to manage all connections (and pipelines) when there are changes in our internal infrastructure. Below is an example of the file format I am considering: [ { "PROD_hostname_IP": "1.2.3.4" }, { "VAL_hostname_IP": "5.6.7.8" } ] Please, how can I use "PROD_hostname_IP" as a parameter in account properties? Thank you, Giuseppe
not every account setting allows you to use expressions, many only accept hardcoded values. If they allow expressions you can use an expression library and then refer to it in your pipeline and use it in the account but this is a hit or miss and will not work in all cases. If you intend to use different configurations/accounts in different environments you should create the accounts in each environments with the values that apply to this environment and then reference the name of the account in the snaps that need it. You can do something like this environment.expr file.
{
// Accounts, one in each environment.
"SFTP_ACCOUNT": {
"IT": "../../shared/SFTP Dev Account",
"TEST": "../../shared/SFTP Test Account",
"Prod": "../../shared/SFTP Prod Account"
},
// Functions
getOrgName : () => pipe.projectPath.split('/')[1],
getEnv : () => this.getOrgName().substr(9),
getEnvValue : (key) => this.get(key).get(this.getEnv())
}upload this as environment.expr to your shared folder and then reference it in the pipeline with the name env, Once you have that you can use lib.env.getEnvValue('SFTP_ACCOUNT') in the account of the Snap. You will however need to manage the hostname in each account.
