add swagger url option (#6122)

This commit is contained in:
Christian Mehlmauer
2020-06-10 01:49:15 +02:00
committed by GitHub
parent cfdfb4462f
commit 5217366c09
2 changed files with 8 additions and 2 deletions

View File

@@ -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/

View File

@@ -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