Copy swagger.json to nginx directory
This commit is contained in:
@@ -35,6 +35,12 @@ docker run -p 80:8080 swaggerapi/swagger-ui
|
|||||||
|
|
||||||
Will start nginx with swagger-ui on port 80.
|
Will start nginx with swagger-ui on port 80.
|
||||||
|
|
||||||
|
Or you can provide your own swagger.json on your host
|
||||||
|
|
||||||
|
```
|
||||||
|
docker run -p 80:8080 -e "SWAGGER_JSON=/foo/swagger.json" -v /bar:/foo swaggerapi/swagger-ui
|
||||||
|
```
|
||||||
|
|
||||||
##### Prerequisites
|
##### Prerequisites
|
||||||
- Node 6.x
|
- Node 6.x
|
||||||
- NPM 3.x
|
- NPM 3.x
|
||||||
|
|||||||
@@ -2,7 +2,8 @@
|
|||||||
|
|
||||||
set -e
|
set -e
|
||||||
|
|
||||||
INDEX_FILE=/usr/share/nginx/html/index.html
|
NGINX_ROOT=/usr/share/nginx/html
|
||||||
|
INDEX_FILE=$NGINX_ROOT/index.html
|
||||||
|
|
||||||
replace_in_index () {
|
replace_in_index () {
|
||||||
if [ "$1" != "**None**" ]; then
|
if [ "$1" != "**None**" ]; then
|
||||||
@@ -30,6 +31,7 @@ if [ "$OAUTH_ADDITIONAL_PARAMS" != "**None**" ]; then
|
|||||||
fi
|
fi
|
||||||
|
|
||||||
if [[ -f $SWAGGER_JSON ]]; then
|
if [[ -f $SWAGGER_JSON ]]; then
|
||||||
|
cp $SWAGGER_JSON $NGINX_ROOT
|
||||||
sed -i "s|http://petstore.swagger.io/v2/swagger.json|swagger.json|g" $INDEX_FILE
|
sed -i "s|http://petstore.swagger.io/v2/swagger.json|swagger.json|g" $INDEX_FILE
|
||||||
sed -i "s|http://example.com/api|swagger.json|g" $INDEX_FILE
|
sed -i "s|http://example.com/api|swagger.json|g" $INDEX_FILE
|
||||||
else
|
else
|
||||||
|
|||||||
Reference in New Issue
Block a user