I'm building a bash script that needs to send a json payload to an API. The payload below is stored in payload.json, will be used all the time and is in the same path as the script. The "" values are what I need to populate with variables from within the same script.
{
"appId": "",
"appName": "",
"authType": "OIDC",
"authSettings": {
"applicationType": "SERVICE",
"clientAuthenticationType": "CLIENT_SECRET",
"grantTypes": [
"CLIENT_CREDENTIALS"
],
"groups": [
""
],
"responseTypes": [
"TOKEN"
],
"inclusion": [
"",
"",
"",
""
],
"tokenValidity": {
"accessTokenLifetimeMinutes": 60,
"refreshTokenLifetimeMinutes": 10080,
"refreshTokenWindowMinutes": 1440
}
}
}
I'm not sure how to achieve this correctly.
How can I pass single values to .appId, .appName and multiple values to .groups[], .inclusion[] all at the same time?
I started on this path for each variable but got nowhere:
appId=31337
jq '.appId = "${appId}"' config.json > tempfile.json
Any help is appreciated.
--argand--argsoptions when invoking jq.