Skip to content

Commit

Permalink
Adding DRAWIO_SERVER_URL new variable
Browse files Browse the repository at this point in the history
  • Loading branch information
m-mohamedin committed Sep 25, 2023
1 parent 75dd012 commit 2d6f60d
Show file tree
Hide file tree
Showing 4 changed files with 15 additions and 5 deletions.
3 changes: 2 additions & 1 deletion image-export/docker-compose.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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:
Expand All @@ -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:
11 changes: 9 additions & 2 deletions main/docker-entrypoint.sh
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
3 changes: 2 additions & 1 deletion self-contained/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -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`
Expand Down
3 changes: 2 additions & 1 deletion self-contained/docker-compose.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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:
Expand All @@ -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}
Expand Down

1 comment on commit 2d6f60d

@davidjgraph
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Reviewed.

Please sign in to comment.