appsettings.sh 4.3 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980
  1. #!/bin/sh
  2. if [ -f "./appsettings.json" ]; then
  3. sed -i -e '/\(DatabaseSettings\|Alexis.*Database\)"/, /}/ s/"Server".*/"Server": "dockerdb"\,/' \
  4. -e '/ReadWriteDatabaseSettings"/, /}/ s/"Database": "AlexisHotWrite".*/"Database": "AlexisReadWrite"\,/' \
  5. -e '/ReadWriteDatabaseSettings"/, /}/ s/"Database": "AlexisColdWrite".*/"Database": "Tier2"\,/' \
  6. -e '/\(DatabaseSettings\|Alexis.*Database\)"/, /}/ {/"AlexisReadWrite/! s/"Database": "Alexis.*/"Database": "AlexisPTSTest"\,/}' \
  7. -e '/\(DatabaseSettings\|Alexis.*Database\)"/, /}/ s/"UserId".*/"UserId": "gpspl"\,/' \
  8. -e '/\(DatabaseSettings\|Alexis.*Database\)"/, /}/ s/"Password".*/"Password": "yW2S6KXdY8"\,/' \
  9. -e '/"AlexisTokenDatabase"/, /}/ s/"Database".*/"Database": "AlexisPTSTokenTest"\,/' \
  10. -e '/"AlexisSecureDatabase"/, /}/ s/"Database".*/"Database": "AlexisSecure"\,/' \
  11. -e '/"MessageBroker"/, /}/ s/localhost/rabbitmq/' \
  12. -e '/"HealthChecks"/, /}/ s,https://localhost:5091,http://dalapi:5090,' \
  13. -e '/"DataAccessLayerApiUrl"/ s/localhost/dalapi/' \
  14. -e '/"LoggingMinResultCount"/ s/:.*/: -1,/' \
  15. -e '/"LoggingMinQueryTimeInMs"/ s/:.*/: -1,/' \
  16. -e '/"TcRecordTablesTestingMode"/ s/true/false/' \
  17. -e '/ConnectionString"/ s/Server=./Server=dockerdb/' \
  18. -e '/ConnectionString"/ s/Password=;/Password=yW2S6KXdY8;/' \
  19. -e '/[Cc]:/ s/\\\\/\\/g;s/\\/\//g;s/[Cc]://' \
  20. -e '/"[Pp]ath"/ s:\\\\:/:g' \
  21. -e '/"StatusWatcherSettings"/, /}/ s/"Frequency".*/"Frequency": "1000"\,/' \
  22. -e '/"StatusWatcherSettings"/, /}/ s|https://localhost:44307|http://alexisapi|' \
  23. -e '/"\(Authority\|RedirectTarget\)":/ s|https://.*"|http://secureapi"|' \
  24. -e '/Api.*": {/, /}/ s|https://localhost:44320|http://secureapi|' \
  25. -e '/Api.*": {/, /}/ s|https://localhost:44307|http://alexisapi|' \
  26. -e 's,\(http\|https\)://localhost:9099,http://ratesapi:9099,' \
  27. -e 's,\(http\|https\)://localhost:500[34],http://providerapi,' \
  28. -e '/"Certificate": {/, /}/ d' \
  29. -e 's|"Url": "http://localhost:63831"|"Url": "http://+:80"|' \
  30. -e 's|"Url": "https://localhost:44307"|"Url": "https://+:443"|' \
  31. -e 's/"\S*:6379/"redis:6379/' \
  32. -e 's/"\S*:5672/"rabbitmq:5672/' \
  33. -e '/"AuthorisationLoadOptions"/, /}/ s/"NewestAuthorisationCutoffInSeconds".*/"NewestAuthorisationCutoffInSeconds": "-3600"\,/' \
  34. -e '/"AuthorisationLoadOptions"/, /}/ s/"MinimumTimeBetweenAuthLoadsInSeconds".*/"MinimumTimeBetweenAuthLoadsInSeconds": "-1"\,/' \
  35. -e '/"Flags"/, /}/ s/"PanHsmPercent".*/"PanHsmPercent": 0\,/' \
  36. -e '/"Flags"/, /}/ s/"PersonalIdNumberHsmPercent".*/"PersonalIdNumberHsmPercent": 0\,/' \
  37. -e '/"WriteTo": \[$/, /\]/ {/.*"Name":.*"Console"/ d}' \
  38. -e '/"WriteTo": \[$/ a \{ "Name": "Console" }, ' \
  39. ./appsettings*.json
  40. fi
  41. if [ $USE_SEQ = "1" ]; then
  42. sed -i -e '/"WriteTo":/,/]\(,\|$\)/ c "WriteTo": \[ { "Name": "Console" },\n { "Name": "Seq", "Args": { "serverUrl": "http://seq", "compact": true, "apiKey" :"m3h0gDAj3kh7XVbNwmkX" } }],' \
  43. ./appsettings*.json
  44. fi
  45. if [ -f "./hosting.json" ]; then
  46. sed -i -e '/"Certificate": {/, /}/ d' hosting.json
  47. fi
  48. if [ -f "./Extensions/ServiceCollectionExtensions.cs" ]; then
  49. sed -i -e 's|C:\\|/|' ./Extensions/ServiceCollectionExtensions.cs
  50. fi
  51. if [ -f "./Startup.cs" ]; then
  52. sed -i 's|app.UseHttpsRedirection|//// app.UseHttpsRedirection|' ./Startup.cs
  53. fi
  54. if [ -f "../GPS.API.SecureHSM/Commands/HsmCommandBase.cs" ]; then
  55. sed -i 's/? true : null/? (bool?)true : null/' ../GPS.API.SecureHSM/Commands/HsmCommandBase.cs
  56. fi
  57. if [ -f "../GPS.Currency.Common/Helpers/SqlDatabaseHelper.cs" ]; then
  58. sed -i 's/CommandType.StoredProcedure : null/CommandType.StoredProcedure : (CommandType?)null/' ../GPS.Currency.Common/Helpers/SqlDatabaseHelper.cs
  59. fi
  60. if [[ $DOTNET_VERSION == 5* ]]; then
  61. sed -i -e 's/netcoreapp3.1/net5.0/' *.csproj
  62. elif [[ $DOTNET_VERSION == 6* ]]; then
  63. sed -i -e 's/netcoreapp3.1/net6.0/' *.csproj
  64. fi
  65. sed -i -e "/<RuntimeIdentifiers/d" *.csproj
  66. if [ $USE_SEQ = "1" ]; then
  67. sed -i -e '/.*\<PackageReference.*Include="Serilog.Sinks.Seq"/d' \
  68. -e '0,/.*\<PackageReference.*/s/.*\<PackageReference.*/\<PackageReference Include="Serilog.Sinks.Seq" Version="5.1.1" \/\>\n&/' \
  69. *.csproj
  70. fi