From 90f71c0d77719871910cfba883a32ad131bef059 Mon Sep 17 00:00:00 2001 From: Draon con Color Date: Wed, 27 Apr 2022 17:40:44 +0200 Subject: [PATCH] feat: add optional BASE_PATH to Docker config (#1378) Co-authored-by: draoncc <14227820+draoncc@users.noreply.github.com> Co-authored-by: anastasiia-developer --- config/docker/Dockerfile | 1 + config/docker/README.md | 3 ++- config/docker/docker-run.sh | 1 + config/docker/index.tpl.html | 4 ++-- 4 files changed, 6 insertions(+), 3 deletions(-) diff --git a/config/docker/Dockerfile b/config/docker/Dockerfile index 94e1762d..55e5d0a9 100644 --- a/config/docker/Dockerfile +++ b/config/docker/Dockerfile @@ -26,6 +26,7 @@ FROM nginx:alpine ENV PAGE_TITLE="ReDoc" ENV PAGE_FAVICON="favicon.png" +ENV BASE_PATH= ENV SPEC_URL="http://petstore.swagger.io/v2/swagger.json" ENV PORT=80 ENV REDOC_OPTIONS= diff --git a/config/docker/README.md b/config/docker/README.md index b25f41bd..8e042f4a 100644 --- a/config/docker/README.md +++ b/config/docker/README.md @@ -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_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 - `PORT` (default `80`) - nginx port -- `REDOC_OPTIONS` - [`` tag attributes](https://github.com/Redocly/redoc#redoc-tag-attributes) +- `REDOC_OPTIONS` (optional) - [`` tag attributes](https://github.com/Redocly/redoc#redoc-tag-attributes) ## Build diff --git a/config/docker/docker-run.sh b/config/docker/docker-run.sh index 2706b243..f9c69e0c 100644 --- a/config/docker/docker-run.sh +++ b/config/docker/docker-run.sh @@ -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_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|%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 diff --git a/config/docker/index.tpl.html b/config/docker/index.tpl.html index 15171edc..83258786 100644 --- a/config/docker/index.tpl.html +++ b/config/docker/index.tpl.html @@ -4,7 +4,7 @@ %PAGE_TITLE% - +