Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- {
- "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"
- }
- {
- "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"
- }
- set "file=test.json"
- set "tmpF=%TEMP%appsettingsJSON_%time:~9,2%.json"
- set "tab= "
- for /F "tokens=1* delims=: " %%V in (%file%) do if %%V=="client_id" ( echo %tab%%%V:"%CLIENT_ID%">>%tmpF% ) else ( if %%V=="client_secret" ( echo %tab%%%V:"%CLIENT_SECRET%">>%tmpF% ) else ( if [%%W]==[] ( echo %%V>>%tmpF% ) else ( echo %tab%%%V:%%W>>%tmpF% ) ) )
- move "%tmpF%" "%file%"
- {
- "appName": "Test",
- "appId": "1",
- "env" : "Test",
- "url" : "https://url.com",
- "client_id": "CLIENT_ID_VALUE",
- "client_secret": "CLIENT_SECRET_VALUE",
- "QAEmail" : "itteam@email.com",
- "Preuri" : "https://preuri.com",
- "Ravuri" : "https://Ravuri.com",
- "Q&A" : "https://QandA.com"
- }
- **1)** Credentials plugin
- **2)** Credential Binding Plugin
- **3)** Windows Power Shell Plugin
- (gc 'C:Documentsapplication.json') -replace 'CLIENT_ID_VALUE', $env:CLIENT_ID_VALUE | Out-File 'C:Documentsapplication.json'
- (gc 'C:Documentsapplication.json') -replace 'CLIENT_SECRET_VALUE', $env:CLIENT_SECRET_VALUE | Out-File
- 'C:Documentsapplication.json'
- @echo off
- setlocal EnableDelayedExpansion
- set "Field[CLIENT_ID]=123456"
- set "Field[CLIENT_SECRET]=654321"
- for /F "tokens=1,2 delims=: " %%a in (appsettings.json) do (
- if defined Field[%%~a] (
- echo %%a: "!Field[%%~a]!"
- ) else if "%%~b" neq "" (
- echo %%a : %%b
- ) else (
- echo %%a
- )
- )
- {
- "client_id": ""
- "client_secret": ""
- "Environment" : "Test"
- "Username" : "rocky"
- "Password" : "rock123"
- }
- {
- "client_id": "123456"
- "client_secret": "654321"
- "Environment" : "Test"
- "Username" : "rocky"
- "Password" : "rock123"
- }
Add Comment
Please, Sign In to add comment