Merge pull request #3957 from mrparkers/base-url
Allow UI base url to be customizable
This commit is contained in:
@@ -13,6 +13,7 @@ ENV OAUTH_APP_NAME "**None**"
|
|||||||
ENV OAUTH_ADDITIONAL_PARAMS "**None**"
|
ENV OAUTH_ADDITIONAL_PARAMS "**None**"
|
||||||
ENV SWAGGER_JSON "/app/swagger.json"
|
ENV SWAGGER_JSON "/app/swagger.json"
|
||||||
ENV PORT 80
|
ENV PORT 80
|
||||||
|
ENV BASE_URL ""
|
||||||
|
|
||||||
RUN apk add --update nginx
|
RUN apk add --update nginx
|
||||||
RUN mkdir -p /run/nginx
|
RUN mkdir -p /run/nginx
|
||||||
|
|||||||
@@ -49,6 +49,14 @@ Or you can provide your own swagger.json on your host
|
|||||||
docker run -p 80:8080 -e SWAGGER_JSON=/foo/swagger.json -v /bar:/foo swaggerapi/swagger-ui
|
docker run -p 80:8080 -e SWAGGER_JSON=/foo/swagger.json -v /bar:/foo swaggerapi/swagger-ui
|
||||||
```
|
```
|
||||||
|
|
||||||
|
The base URL of the web application can be changed by specifying the `BASE_URL` environment variable:
|
||||||
|
|
||||||
|
```
|
||||||
|
docker run -p 80:8080 -e BASE_URL=/swagger -e SWAGGER_JSON=/foo/swagger.json -v /bar:/foo swaggerapi/swagger-ui
|
||||||
|
```
|
||||||
|
|
||||||
|
This will serve Swagger UI at `/swagger` instead of `/`.
|
||||||
|
|
||||||
##### Prerequisites
|
##### Prerequisites
|
||||||
- Node 6.x
|
- Node 6.x
|
||||||
- NPM 3.x
|
- NPM 3.x
|
||||||
|
|||||||
@@ -21,6 +21,16 @@ replace_or_delete_in_index () {
|
|||||||
fi
|
fi
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if [ "${BASE_URL}" ]; then
|
||||||
|
NGINX_WITH_BASE_URL="${NGINX_ROOT}${BASE_URL}"
|
||||||
|
|
||||||
|
mkdir -p ${NGINX_WITH_BASE_URL}
|
||||||
|
mv ${NGINX_ROOT}/*.* ${NGINX_WITH_BASE_URL}/
|
||||||
|
|
||||||
|
INDEX_FILE=$NGINX_WITH_BASE_URL/index.html
|
||||||
|
NGINX_ROOT=$NGINX_WITH_BASE_URL
|
||||||
|
fi
|
||||||
|
|
||||||
replace_in_index myApiKeyXXXX123456789 $API_KEY
|
replace_in_index myApiKeyXXXX123456789 $API_KEY
|
||||||
replace_or_delete_in_index your-client-id $OAUTH_CLIENT_ID
|
replace_or_delete_in_index your-client-id $OAUTH_CLIENT_ID
|
||||||
replace_or_delete_in_index your-client-secret-if-required $OAUTH_CLIENT_SECRET
|
replace_or_delete_in_index your-client-secret-if-required $OAUTH_CLIENT_SECRET
|
||||||
|
|||||||
Reference in New Issue
Block a user