From 454528d55b2a8bbd399d76a157fcd587e2c4b214 Mon Sep 17 00:00:00 2001 From: jasquat Date: Fri, 7 Apr 2023 16:30:44 -0400 Subject: [PATCH] attempt to get version info in frontend w/ burnettk --- spiffworkflow-frontend/Dockerfile | 2 ++ spiffworkflow-frontend/bin/boot_server_in_docker | 5 +++++ spiffworkflow-frontend/public/index.html | 1 + spiffworkflow-frontend/src/routes/ProcessModelShow.tsx | 4 ++++ 4 files changed, 12 insertions(+) diff --git a/spiffworkflow-frontend/Dockerfile b/spiffworkflow-frontend/Dockerfile index c777a2683..abdb4363d 100644 --- a/spiffworkflow-frontend/Dockerfile +++ b/spiffworkflow-frontend/Dockerfile @@ -39,4 +39,6 @@ COPY --from=setup /app/build /app/build COPY --from=setup /app/bin /app/bin COPY --from=setup /app/node_modules.justserve /app/node_modules +ENV REACT_APP_VERSION_INFO="123" + ENTRYPOINT ["/app/bin/boot_server_in_docker"] diff --git a/spiffworkflow-frontend/bin/boot_server_in_docker b/spiffworkflow-frontend/bin/boot_server_in_docker index 9cb998652..74fcb49f9 100755 --- a/spiffworkflow-frontend/bin/boot_server_in_docker +++ b/spiffworkflow-frontend/bin/boot_server_in_docker @@ -7,6 +7,11 @@ function error_handler() { trap 'error_handler ${LINENO} $?' ERR set -o errtrace -o errexit -o nounset -o pipefail +if [[ -f app_version.json ]]; then + SPIFFWORKFLOW_FRONTEND_RUNTIME_CONFIG_REACT_APP_VERSION_INFO_JSON=$(cat app_version.json) + export SPIFFWORKFLOW_FRONTEND_RUNTIME_CONFIG_REACT_APP_VERSION_INFO_JSON +fi + # sort of like https://lithic.tech/blog/2020-05/react-dynamic-config, but without golang react_configs=$(env | grep -E "^SPIFFWORKFLOW_FRONTEND_RUNTIME_CONFIG_" || echo '') if [[ -n "$react_configs" ]]; then diff --git a/spiffworkflow-frontend/public/index.html b/spiffworkflow-frontend/public/index.html index 111f3c6d6..09516d942 100644 --- a/spiffworkflow-frontend/public/index.html +++ b/spiffworkflow-frontend/public/index.html @@ -5,6 +5,7 @@ + { + console.log( + 'process.env.REACT_APP_VERSION_INFO', + process.env.REACT_APP_VERSION_INFO + ); const processResult = (result: ProcessModel) => { setProcessModel(result); setReloadModel(false);