File tree Expand file tree Collapse file tree 2 files changed +12
-3
lines changed
Expand file tree Collapse file tree 2 files changed +12
-3
lines changed Original file line number Diff line number Diff line change @@ -40,6 +40,12 @@ docker run -p 80:8080 swaggerapi/swagger-ui
4040
4141Will start nginx with swagger-ui on port 80.
4242
43+ Or you can provide your own swagger.json on your host
44+
45+ ```
46+ docker run -p 80:8080 -e "SWAGGER_JSON=/foo/swagger.json" -v /bar:/foo swaggerapi/swagger-ui
47+ ```
48+
4349##### Prerequisites
4450- Node 6.x
4551- NPM 3.x
Original file line number Diff line number Diff line change 22
33set -e
44
5- INDEX_FILE=/usr/share/nginx/html/index.html
5+ NGINX_ROOT=/usr/share/nginx/html
6+ INDEX_FILE=$NGINX_ROOT /index.html
67
78replace_in_index () {
89 if [ " $1 " != " **None**" ]; then
@@ -30,8 +31,10 @@ if [ "$OAUTH_ADDITIONAL_PARAMS" != "**None**" ]; then
3031fi
3132
3233if [[ -f $SWAGGER_JSON ]]; then
33- sed -i " s|http://petstore.swagger.io/v2/swagger.json|swagger.json|g" $INDEX_FILE
34- sed -i " s|http://example.com/api|swagger.json|g" $INDEX_FILE
34+ cp $SWAGGER_JSON $NGINX_ROOT
35+ REL_PATH=" /$( basename $SWAGGER_JSON ) "
36+ sed -i " s|http://petstore.swagger.io/v2/swagger.json|$REL_PATH |g" $INDEX_FILE
37+ sed -i " s|http://example.com/api|$REL_PATH |g" $INDEX_FILE
3538else
3639 sed -i " s|http://petstore.swagger.io/v2/swagger.json|$API_URL |g" $INDEX_FILE
3740 sed -i " s|http://example.com/api|$API_URL |g" $INDEX_FILE
You can’t perform that action at this time.
0 commit comments