2016-03-10 11:05:12 +01:00
|
|
|
#!/bin/bash
|
2016-04-26 17:35:12 +02:00
|
|
|
SCHEME=http
|
|
|
|
SERVER_IP=reg.mydomain.com
|
2016-03-10 11:05:12 +01:00
|
|
|
set -e
|
|
|
|
echo "Doing some clean up..."
|
|
|
|
rm -f *.tar.gz
|
|
|
|
echo "Downloading Swagger UI release package..."
|
|
|
|
wget https://github.com/swagger-api/swagger-ui/archive/v2.1.4.tar.gz -O swagger.tar.gz
|
|
|
|
echo "Untarring Swagger UI package to the static file path..."
|
2017-06-09 07:45:51 +02:00
|
|
|
mkdir -p ../src/ui/static/vendors
|
2016-10-19 08:32:00 +02:00
|
|
|
tar -C ../src/ui/static/vendors -zxf swagger.tar.gz swagger-ui-2.1.4/dist
|
2016-03-10 11:05:12 +01:00
|
|
|
echo "Executing some processes..."
|
2016-05-17 08:18:05 +02:00
|
|
|
sed -i.bak 's/http:\/\/petstore\.swagger\.io\/v2\/swagger\.json/'$SCHEME':\/\/'$SERVER_IP'\/static\/resources\/yaml\/swagger\.yaml/g' \
|
2016-10-19 08:32:00 +02:00
|
|
|
../src/ui/static/vendors/swagger-ui-2.1.4/dist/index.html
|
|
|
|
sed -i.bak '/jsonEditor: false,/a\ validatorUrl: null,' ../src/ui/static/vendors/swagger-ui-2.1.4/dist/index.html
|
|
|
|
mkdir -p ../src/ui/static/resources/yaml
|
|
|
|
cp swagger.yaml ../src/ui/static/resources/yaml
|
|
|
|
sed -i.bak 's/host: localhost/host: '$SERVER_IP'/g' ../src/ui/static/resources/yaml/swagger.yaml
|
|
|
|
sed -i.bak 's/ \- http$/ \- '$SCHEME'/g' ../src/ui/static/resources/yaml/swagger.yaml
|
2016-03-10 11:05:12 +01:00
|
|
|
echo "Finish preparation for the Swagger UI."
|