mirror of
https://github.com/goharbor/harbor.git
synced 2024-10-06 17:27:35 +02:00
Merge pull request #167 from wknet123/master
update Swagger for http/https schemes support
This commit is contained in:
commit
2156bb5bea
@ -22,6 +22,10 @@ From time to time, you may need to mannually test Harbor REST API. You can deplo
|
|||||||
```sh
|
```sh
|
||||||
vi prepare-swagger.sh
|
vi prepare-swagger.sh
|
||||||
```
|
```
|
||||||
|
* Change the SCHEME to the protocol scheme of your Harbor server.
|
||||||
|
```sh
|
||||||
|
SCHEME=<HARBOR_SERVER_SCHEME>
|
||||||
|
```
|
||||||
* Change the SERVER_IP to the IP address of your Harbor server.
|
* Change the SERVER_IP to the IP address of your Harbor server.
|
||||||
```sh
|
```sh
|
||||||
SERVER_ID=<HARBOR_SERVER_DOMAIN>
|
SERVER_ID=<HARBOR_SERVER_DOMAIN>
|
||||||
|
@ -1,5 +1,6 @@
|
|||||||
#!/bin/bash
|
#!/bin/bash
|
||||||
SERVER_IP=10.117.170.65
|
SCHEME=http
|
||||||
|
SERVER_IP=reg.mydomain.com
|
||||||
set -e
|
set -e
|
||||||
echo "Doing some clean up..."
|
echo "Doing some clean up..."
|
||||||
rm -f *.tar.gz
|
rm -f *.tar.gz
|
||||||
@ -8,9 +9,10 @@ wget https://github.com/swagger-api/swagger-ui/archive/v2.1.4.tar.gz -O swagger.
|
|||||||
echo "Untarring Swagger UI package to the static file path..."
|
echo "Untarring Swagger UI package to the static file path..."
|
||||||
tar -C ../static/vendors -zxf swagger.tar.gz swagger-ui-2.1.4/dist
|
tar -C ../static/vendors -zxf swagger.tar.gz swagger-ui-2.1.4/dist
|
||||||
echo "Executing some processes..."
|
echo "Executing some processes..."
|
||||||
sed -i 's/http:\/\/petstore\.swagger\.io\/v2\/swagger\.json/http:\/\/'$SERVER_IP'\/static\/resources\/yaml\/swagger\.yaml/g' \
|
sed -i 's/http:\/\/petstore\.swagger\.io\/v2\/swagger\.json/'$SCHEME':\/\/'$SERVER_IP'\/static\/resources\/yaml\/swagger\.yaml/g' \
|
||||||
../static/vendors/swagger-ui-2.1.4/dist/index.html
|
../static/vendors/swagger-ui-2.1.4/dist/index.html
|
||||||
mkdir -p ../static/resources/yaml
|
mkdir -p ../static/resources/yaml
|
||||||
cp swagger.yaml ../static/resources/yaml
|
cp swagger.yaml ../static/resources/yaml
|
||||||
sed -i 's/host: localhost/host: '$SERVER_IP'/g' ../static/resources/yaml/swagger.yaml
|
sed -i 's/host: localhost/host: '$SERVER_IP'/g' ../static/resources/yaml/swagger.yaml
|
||||||
|
sed -i 's/ \- http$/ \- '$SCHEME'/g' ../static/resources/yaml/swagger.yaml
|
||||||
echo "Finish preparation for the Swagger UI."
|
echo "Finish preparation for the Swagger UI."
|
||||||
|
Loading…
Reference in New Issue
Block a user