Guest User

Untitled

a guest
Aug 22nd, 2018
165
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 2.09 KB | None | 0 0
  1. {
  2. "appName": "Test",
  3. "appId": "1",
  4. "env" : "Test",
  5. "url" : "https://url.com",
  6. "client_id": "",
  7. "client_secret": "",
  8. "QAEmail" : "itteam@email.com",
  9. "Preuri" : "https://preuri.com",
  10. "Ravuri" : "https://Ravuri.com",
  11. "Q&A" : "https://QandA.com"
  12. }
  13.  
  14. {
  15. "appName": "Test",
  16. "appId": "1",
  17. "env" : "Test",
  18. "url" : "https://url.com",
  19. "client_id": "123456",
  20. "client_secret": "654321",
  21. "QAEmail" : "itteam@email.com",
  22. "Preuri" : "https://preuri.com",
  23. "Ravuri" : "https://Ravuri.com",
  24. "Q&A" : "https://QandA.com"
  25. }
  26.  
  27. set "file=test.json"
  28. set "tmpF=%TEMP%appsettingsJSON_%time:~9,2%.json"
  29. set "tab= "
  30. 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% ) ) )
  31. move "%tmpF%" "%file%"
  32.  
  33. {
  34. "appName": "Test",
  35. "appId": "1",
  36. "env" : "Test",
  37. "url" : "https://url.com",
  38. "client_id": "CLIENT_ID_VALUE",
  39. "client_secret": "CLIENT_SECRET_VALUE",
  40. "QAEmail" : "itteam@email.com",
  41. "Preuri" : "https://preuri.com",
  42. "Ravuri" : "https://Ravuri.com",
  43. "Q&A" : "https://QandA.com"
  44. }
  45.  
  46. **1)** Credentials plugin
  47.  
  48. **2)** Credential Binding Plugin
  49.  
  50. **3)** Windows Power Shell Plugin
  51.  
  52. (gc 'C:Documentsapplication.json') -replace 'CLIENT_ID_VALUE', $env:CLIENT_ID_VALUE | Out-File 'C:Documentsapplication.json'
  53.  
  54. (gc 'C:Documentsapplication.json') -replace 'CLIENT_SECRET_VALUE', $env:CLIENT_SECRET_VALUE | Out-File
  55. 'C:Documentsapplication.json'
  56.  
  57. @echo off
  58. setlocal EnableDelayedExpansion
  59.  
  60. set "Field[CLIENT_ID]=123456"
  61. set "Field[CLIENT_SECRET]=654321"
  62.  
  63. for /F "tokens=1,2 delims=: " %%a in (appsettings.json) do (
  64. if defined Field[%%~a] (
  65. echo %%a: "!Field[%%~a]!"
  66. ) else if "%%~b" neq "" (
  67. echo %%a : %%b
  68. ) else (
  69. echo %%a
  70. )
  71. )
  72.  
  73. {
  74. "client_id": ""
  75. "client_secret": ""
  76. "Environment" : "Test"
  77. "Username" : "rocky"
  78. "Password" : "rock123"
  79. }
  80.  
  81. {
  82. "client_id": "123456"
  83. "client_secret": "654321"
  84. "Environment" : "Test"
  85. "Username" : "rocky"
  86. "Password" : "rock123"
  87. }
Add Comment
Please, Sign In to add comment