mirror of
https://github.com/Redocly/redoc.git
synced 2024-11-25 01:53:44 +03:00
feat: add optional BASE_PATH to Docker config (#1378)
Co-authored-by: draoncc <14227820+draoncc@users.noreply.github.com> Co-authored-by: anastasiia-developer <anastasiia@redocly.com>
This commit is contained in:
parent
aba2d1ad2d
commit
90f71c0d77
|
@ -26,6 +26,7 @@ FROM nginx:alpine
|
||||||
|
|
||||||
ENV PAGE_TITLE="ReDoc"
|
ENV PAGE_TITLE="ReDoc"
|
||||||
ENV PAGE_FAVICON="favicon.png"
|
ENV PAGE_FAVICON="favicon.png"
|
||||||
|
ENV BASE_PATH=
|
||||||
ENV SPEC_URL="http://petstore.swagger.io/v2/swagger.json"
|
ENV SPEC_URL="http://petstore.swagger.io/v2/swagger.json"
|
||||||
ENV PORT=80
|
ENV PORT=80
|
||||||
ENV REDOC_OPTIONS=
|
ENV REDOC_OPTIONS=
|
||||||
|
|
|
@ -45,9 +45,10 @@ Another issue with OpenShift is that the default exposed port `80` cannot be use
|
||||||
|
|
||||||
- `PAGE_TITLE` (default `"ReDoc"`) - page title
|
- `PAGE_TITLE` (default `"ReDoc"`) - page title
|
||||||
- `PAGE_FAVICON` (default `"favicon.png"`) - URL to page favicon
|
- `PAGE_FAVICON` (default `"favicon.png"`) - URL to page favicon
|
||||||
|
- `BASE_PATH` (optional) - prepend favicon & standalone bundle with this path
|
||||||
- `SPEC_URL` (default `"http://petstore.swagger.io/v2/swagger.json"`) - URL to spec
|
- `SPEC_URL` (default `"http://petstore.swagger.io/v2/swagger.json"`) - URL to spec
|
||||||
- `PORT` (default `80`) - nginx port
|
- `PORT` (default `80`) - nginx port
|
||||||
- `REDOC_OPTIONS` - [`<redoc>` tag attributes](https://github.com/Redocly/redoc#redoc-tag-attributes)
|
- `REDOC_OPTIONS` (optional) - [`<redoc>` tag attributes](https://github.com/Redocly/redoc#redoc-tag-attributes)
|
||||||
|
|
||||||
## Build
|
## Build
|
||||||
|
|
||||||
|
|
|
@ -4,6 +4,7 @@ set -e
|
||||||
|
|
||||||
sed -i -e "s|%PAGE_TITLE%|$PAGE_TITLE|g" /usr/share/nginx/html/index.html
|
sed -i -e "s|%PAGE_TITLE%|$PAGE_TITLE|g" /usr/share/nginx/html/index.html
|
||||||
sed -i -e "s|%PAGE_FAVICON%|$PAGE_FAVICON|g" /usr/share/nginx/html/index.html
|
sed -i -e "s|%PAGE_FAVICON%|$PAGE_FAVICON|g" /usr/share/nginx/html/index.html
|
||||||
|
sed -i -e "s|%BASE_PATH%|$BASE_PATH|g" /usr/share/nginx/html/index.html
|
||||||
sed -i -e "s|%SPEC_URL%|$SPEC_URL|g" /usr/share/nginx/html/index.html
|
sed -i -e "s|%SPEC_URL%|$SPEC_URL|g" /usr/share/nginx/html/index.html
|
||||||
sed -i -e "s|%REDOC_OPTIONS%|${REDOC_OPTIONS}|g" /usr/share/nginx/html/index.html
|
sed -i -e "s|%REDOC_OPTIONS%|${REDOC_OPTIONS}|g" /usr/share/nginx/html/index.html
|
||||||
sed -i -e "s|\(listen\s*\) [0-9]*|\1 ${PORT}|g" /etc/nginx/nginx.conf
|
sed -i -e "s|\(listen\s*\) [0-9]*|\1 ${PORT}|g" /etc/nginx/nginx.conf
|
||||||
|
|
|
@ -4,7 +4,7 @@
|
||||||
<meta charset="UTF-8" />
|
<meta charset="UTF-8" />
|
||||||
<meta name="viewport" content="width=device-width, initial-scale=1" />
|
<meta name="viewport" content="width=device-width, initial-scale=1" />
|
||||||
<title>%PAGE_TITLE%</title>
|
<title>%PAGE_TITLE%</title>
|
||||||
<link rel="icon" href="%PAGE_FAVICON%" />
|
<link rel="icon" href="%BASE_PATH%%PAGE_FAVICON%" />
|
||||||
<style>
|
<style>
|
||||||
body {
|
body {
|
||||||
margin: 0;
|
margin: 0;
|
||||||
|
@ -23,6 +23,6 @@
|
||||||
|
|
||||||
<body>
|
<body>
|
||||||
<redoc spec-url="%SPEC_URL%" %REDOC_OPTIONS%></redoc>
|
<redoc spec-url="%SPEC_URL%" %REDOC_OPTIONS%></redoc>
|
||||||
<script src="redoc.standalone.js"></script>
|
<script src="%BASE_PATH%redoc.standalone.js"></script>
|
||||||
</body>
|
</body>
|
||||||
</html>
|
</html>
|
||||||
|
|
Loading…
Reference in New Issue
Block a user