Вы не можете выбрать более 25 тем Темы должны начинаться с буквы или цифры, могут содержать дефисы(-) и должны содержать не более 35 символов.
 
 
 
 

49 строки
1.4 KiB

  1. #! /bin/sh
  2. set -e
  3. INDEX_FILE=/usr/share/nginx/html/index.html
  4. replace_in_index () {
  5. if [ "$1" != "**None**" ]; then
  6. sed -i "s|/\*||g" $INDEX_FILE
  7. sed -i "s|\*/||g" $INDEX_FILE
  8. sed -i "s|$1|$2|g" $INDEX_FILE
  9. fi
  10. }
  11. replace_or_delete_in_index () {
  12. if [ -z "$2" ]; then
  13. sed -i "/$1/d" $INDEX_FILE
  14. else
  15. replace_in_index $1 $2
  16. fi
  17. }
  18. replace_in_index myApiKeyXXXX123456789 $API_KEY
  19. replace_or_delete_in_index your-client-id $OAUTH_CLIENT_ID
  20. replace_or_delete_in_index your-client-secret-if-required $OAUTH_CLIENT_SECRET
  21. replace_or_delete_in_index your-realms $OAUTH_REALM
  22. replace_or_delete_in_index your-app-name $OAUTH_APP_NAME
  23. if [ "$OAUTH_ADDITIONAL_PARAMS" != "**None**" ]; then
  24. replace_in_index "additionalQueryStringParams: {}" "additionalQueryStringParams: {$OAUTH_ADDITIONAL_PARAMS}"
  25. fi
  26. if [[ -f $SWAGGER_JSON ]]; then
  27. sed -i "s|http://petstore.swagger.io/v2/swagger.json|swagger.json|g" $INDEX_FILE
  28. sed -i "s|http://example.com/api|swagger.json|g" $INDEX_FILE
  29. else
  30. sed -i "s|http://petstore.swagger.io/v2/swagger.json|$API_URL|g" $INDEX_FILE
  31. sed -i "s|http://example.com/api|$API_URL|g" $INDEX_FILE
  32. fi
  33. if [[ -n "$VALIDATOR_URL" ]]; then
  34. sed -i "s|.*validatorUrl:.*$||g" $INDEX_FILE
  35. TMP_VU="$VALIDATOR_URL"
  36. [[ "$VALIDATOR_URL" != "null" && "$VALIDATOR_URL" != "undefined" ]] && TMP_VU="\"${VALIDATOR_URL}\""
  37. sed -i "s|\(url: .*,\)|\1\n validatorUrl: ${TMP_VU},|g" $INDEX_FILE
  38. unset TMP_VU
  39. fi
  40. exec nginx -g 'daemon off;'