Skip to content

Commit

Permalink
add swagger url option (swagger-api#6122)
Browse files Browse the repository at this point in the history
  • Loading branch information
firefart authored Jun 9, 2020
1 parent cfdfb44 commit 5217366
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 2 deletions.
1 change: 1 addition & 0 deletions Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@ ENV API_KEY "**None**"
ENV SWAGGER_JSON "/app/swagger.json"
ENV PORT 8080
ENV BASE_URL ""
ENV SWAGGER_JSON_URL ""

COPY ./docker/nginx.conf ./docker/cors.conf /etc/nginx/

Expand Down
9 changes: 7 additions & 2 deletions docker/run.sh
Original file line number Diff line number Diff line change
Expand Up @@ -29,8 +29,13 @@ fi

replace_in_index myApiKeyXXXX123456789 $API_KEY

if [[ -f $SWAGGER_JSON ]]; then
cp -s $SWAGGER_JSON $NGINX_ROOT
if [ "$SWAGGER_JSON_URL" ]; then
sed -i "s|https://petstore.swagger.io/v2/swagger.json|$SWAGGER_JSON_URL|g" $INDEX_FILE
sed -i "s|http://example.com/api|$SWAGGER_JSON_URL|g" $INDEX_FILE
fi

if [[ -f "$SWAGGER_JSON" ]]; then
cp -s "$SWAGGER_JSON" "$NGINX_ROOT"
REL_PATH="./$(basename $SWAGGER_JSON)"
sed -i "s|https://petstore.swagger.io/v2/swagger.json|$REL_PATH|g" $INDEX_FILE
sed -i "s|http://example.com/api|$REL_PATH|g" $INDEX_FILE
Expand Down

0 comments on commit 5217366

Please sign in to comment.