I have below JSON file at %Workspace%\solution\config\appsettings.json
{
"appName": "Test",
"appId": "1",
"env" : "Test",
"url" : "https://url.com",
"client_id": "",
"client_secret": "",
"QAEmail" : "itteam@email.com",
"Preuri" : "https://preuri.com",
"Ravuri" : "https://Ravuri.com",
"Q&A" : "https://QandA.com"
}
I won't be able to commit client id and client secret to git due to the security issues, but I need them to run my API test scripts through Jenkins.
So we need to alter the above json file to below one using environment variables. I have created two global credentials with a secret text CLIENT_ID
and CLIENT_SECRET
.
Can someone help me to write a windows batch command to replace the above json file with CLIENT_ID
and CLIENT_SECRET
?
For example if CLIENT_ID = 123456
and CLIENT_SECRET = 654321
, the json file should be altered to following.
{
"appName": "Test",
"appId": "1",
"env" : "Test",
"url" : "https://url.com",
"client_id": "123456",
"client_secret": "654321",
"QAEmail" : "itteam@email.com",
"Preuri" : "https://preuri.com",
"Ravuri" : "https://Ravuri.com",
"Q&A" : "https://QandA.com"
}
Any help would be appreciated.