improve(docker): support multiple API URLs option (#4044)
The API_URLS environment variable can be used to run the Docker image with multiple urls.
Example:
docker run -p 80:8080 -e API_URLS=[{name:"First API", url:"http://firstapiurl"},{name:"Second API", url:"http://secondapiurl"}] swaggerapi/swagger-ui
This commit is contained in:
@@ -5,6 +5,7 @@ MAINTAINER fehguy
|
|||||||
ENV VERSION "v2.2.10"
|
ENV VERSION "v2.2.10"
|
||||||
ENV FOLDER "swagger-ui-2.2.10"
|
ENV FOLDER "swagger-ui-2.2.10"
|
||||||
ENV API_URL "http://petstore.swagger.io/v2/swagger.json"
|
ENV API_URL "http://petstore.swagger.io/v2/swagger.json"
|
||||||
|
ENV API_URLS ""
|
||||||
ENV API_KEY "**None**"
|
ENV API_KEY "**None**"
|
||||||
ENV OAUTH_CLIENT_ID "**None**"
|
ENV OAUTH_CLIENT_ID "**None**"
|
||||||
ENV OAUTH_CLIENT_SECRET "**None**"
|
ENV OAUTH_CLIENT_SECRET "**None**"
|
||||||
|
|||||||
@@ -53,7 +53,14 @@ if [[ -n "$VALIDATOR_URL" ]]; then
|
|||||||
unset TMP_VU
|
unset TMP_VU
|
||||||
fi
|
fi
|
||||||
|
|
||||||
# replace the PORT that nginx listens on if supplied
|
# replace `url` with `urls` option if API_URLS is set
|
||||||
if [[ -n "${PORT}" ]]; then sed -i "s|8080|${PORT}|g" /etc/nginx/nginx.conf; fi
|
if [[ -n "$API_URLS" ]]; then
|
||||||
|
sed -i "s|url: .*,|urls: $API_URLS,|g" $INDEX_FILE
|
||||||
|
fi
|
||||||
|
|
||||||
|
# replace the PORT that nginx listens on if PORT is supplied
|
||||||
|
if [[ -n "${PORT}" ]]; then
|
||||||
|
sed -i "s|8080|${PORT}|g" /etc/nginx/nginx.conf
|
||||||
|
fi
|
||||||
|
|
||||||
exec nginx -g 'daemon off;'
|
exec nginx -g 'daemon off;'
|
||||||
|
|||||||
Reference in New Issue
Block a user