From 2d6f60db48561758d7749aa79357ccbbde789abd Mon Sep 17 00:00:00 2001 From: Mohamed Mohamedin Date: Mon, 25 Sep 2023 13:20:52 -0400 Subject: [PATCH] Adding DRAWIO_SERVER_URL new variable --- image-export/docker-compose.yml | 3 ++- main/docker-entrypoint.sh | 11 +++++++++-- self-contained/README.md | 3 ++- self-contained/docker-compose.yml | 3 ++- 4 files changed, 15 insertions(+), 5 deletions(-) diff --git a/image-export/docker-compose.yml b/image-export/docker-compose.yml index 60532cc..ec10614 100644 --- a/image-export/docker-compose.yml +++ b/image-export/docker-compose.yml @@ -9,7 +9,7 @@ services: volumes: - ./fonts:/usr/share/fonts/drawio environment: - - DRAWIO_SERVER_URL=${DRAWIO_BASE_URL} + - DRAWIO_BASE_URL=${DRAWIO_BASE_URL} drawio: image: jgraph/drawio ports: @@ -22,5 +22,6 @@ services: environment: - EXPORT_URL=http://image-export:8000/ - DRAWIO_BASE_URL=${DRAWIO_BASE_URL} + - DRAWIO_SERVER_URL=${DRAWIO_SERVER_URL} networks: drawionet: diff --git a/main/docker-entrypoint.sh b/main/docker-entrypoint.sh index 1401c05..89e2c7b 100755 --- a/main/docker-entrypoint.sh +++ b/main/docker-entrypoint.sh @@ -29,8 +29,15 @@ if [[ "${DRAWIO_SELF_CONTAINED}" ]]; then elif [[ "${EXPORT_URL}" ]]; then echo "window.EXPORT_URL = '/service/0';" >> $CATALINA_HOME/webapps/draw/js/PreConfig.js fi -#DRAWIO_BASE_URL is path to base of deployment, e.g. https://www.example.com/folder -echo "window.DRAWIO_BASE_URL = '${DRAWIO_BASE_URL:-http://localhost:8080}';" >> $CATALINA_HOME/webapps/draw/js/PreConfig.js +#DRAWIO_SERVER_URL is the new URL of the deployment, e.g. https://www.example.com/drawio +#DRAWIO_BASE_URL is still used by viewer, lightbox and embed. For backwards compatibility, DRAWIO_SERVER_URL is set to DRAWIO_BASE_URL if not specified. +if [[ "${DRAWIO_SERVER_URL}" ]]; then + echo "window.DRAWIO_SERVER_URL = '${DRAWIO_SERVER_URL}';" >> $CATALINA_HOME/webapps/draw/js/PreConfig.js + echo "window.DRAWIO_BASE_URL = '${DRAWIO_BASE_URL:-${DRAWIO_SERVER_URL}}';" >> $CATALINA_HOME/webapps/draw/js/PreConfig.js +else + echo "window.DRAWIO_BASE_URL = '${DRAWIO_BASE_URL:-http://localhost:8080}';" >> $CATALINA_HOME/webapps/draw/js/PreConfig.js + echo "window.DRAWIO_SERVER_URL = window.DRAWIO_BASE_URL;" >> $CATALINA_HOME/webapps/draw/js/PreConfig.js +fi #DRAWIO_VIEWER_URL is path to the viewer js, e.g. https://www.example.com/js/viewer.min.js echo "window.DRAWIO_VIEWER_URL = '${DRAWIO_VIEWER_URL}';" >> $CATALINA_HOME/webapps/draw/js/PreConfig.js #DRAWIO_LIGHTBOX_URL Replace with your lightbox URL, eg. https://www.example.com diff --git a/self-contained/README.md b/self-contained/README.md index f5b6b52..8744a0f 100644 --- a/self-contained/README.md +++ b/self-contained/README.md @@ -10,7 +10,8 @@ The best option for Windows users is to copy the contents of `Windowsdrive:/Wind You can customize the application by setting the following environment variables. -* `DRAWIO_BASE_URL`: Your deployment base URL. For example, `https://drawio.example.com` or `https://www.example.com/drawio` if it is deployed into a folder. +* `DRAWIO_SERVER_URL`: Your deployment base URL. For example, `https://drawio.example.com` or `https://www.example.com/drawio` if it is deployed into a folder. +* `DRAWIO_BASE_URL`: Your deployment base URL but used with the viewer, lightbox and embed. Usually the same as `DRAWIO_SERVER_URL`. * `DRAWIO_CSP_HEADER`: (Optional) Your website Content-Security-Policy if you want to customize it. * `DRAWIO_VIEWER_URL`: (Optional) If you want to host a draw.io viewer also, set the viewer URL. For example, `https://drawio.example.com/js/viewer.min.js` * `DRAWIO_LIGHTBOX_URL`: (Optional) If you want to host a draw.io viewer also, set the lightbox URL. For example, `https://drawio.example.com` diff --git a/self-contained/docker-compose.yml b/self-contained/docker-compose.yml index f40fa2e..a0ae12a 100644 --- a/self-contained/docker-compose.yml +++ b/self-contained/docker-compose.yml @@ -17,7 +17,7 @@ services: volumes: - fonts_volume:/usr/share/fonts/drawio environment: - - DRAWIO_SERVER_URL=${DRAWIO_BASE_URL} + - DRAWIO_BASE_URL=${DRAWIO_BASE_URL} drawio: image: jgraph/drawio ports: @@ -36,6 +36,7 @@ services: - PLANTUML_URL=http://plantuml-server:8080/ - EXPORT_URL=http://image-export:8000/ - DRAWIO_BASE_URL=${DRAWIO_BASE_URL} + - DRAWIO_SERVER_URL=${DRAWIO_SERVER_URL} - DRAWIO_CSP_HEADER=${DRAWIO_CSP_HEADER} - DRAWIO_VIEWER_URL=${DRAWIO_VIEWER_URL} - DRAWIO_LIGHTBOX_URL=${DRAWIO_LIGHTBOX_URL}