add swagger url option (#6122)
This commit is contained in:
committed by
GitHub
parent
cfdfb4462f
commit
5217366c09
@@ -12,6 +12,7 @@ ENV API_KEY "**None**"
|
|||||||
ENV SWAGGER_JSON "/app/swagger.json"
|
ENV SWAGGER_JSON "/app/swagger.json"
|
||||||
ENV PORT 8080
|
ENV PORT 8080
|
||||||
ENV BASE_URL ""
|
ENV BASE_URL ""
|
||||||
|
ENV SWAGGER_JSON_URL ""
|
||||||
|
|
||||||
COPY ./docker/nginx.conf ./docker/cors.conf /etc/nginx/
|
COPY ./docker/nginx.conf ./docker/cors.conf /etc/nginx/
|
||||||
|
|
||||||
|
|||||||
@@ -29,8 +29,13 @@ fi
|
|||||||
|
|
||||||
replace_in_index myApiKeyXXXX123456789 $API_KEY
|
replace_in_index myApiKeyXXXX123456789 $API_KEY
|
||||||
|
|
||||||
if [[ -f $SWAGGER_JSON ]]; then
|
if [ "$SWAGGER_JSON_URL" ]; then
|
||||||
cp -s $SWAGGER_JSON $NGINX_ROOT
|
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)"
|
REL_PATH="./$(basename $SWAGGER_JSON)"
|
||||||
sed -i "s|https://petstore.swagger.io/v2/swagger.json|$REL_PATH|g" $INDEX_FILE
|
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
|
sed -i "s|http://example.com/api|$REL_PATH|g" $INDEX_FILE
|
||||||
|
|||||||
Reference in New Issue
Block a user