Is there a way to configure an npm run script to use different AWS accounts based on the environment?
{
"config": {
"acc": if ({npm_config_env} == "dev") "account1" else "account_2"
},
"scripts":{
"con": "AWS_DEFAULT_PROFILE=${npm_package_config_acc} aws s3"
}
}
For example, when running npm run con --env=dev
, account1 should be used.
And when running npm run con --env=prod
, account2 should be used.
I've searched online but couldn't find any information on whether or not npm run can handle if statements. If anyone knows of a workaround, I would greatly appreciate it!