From 855288368c86d3c02e262cb53e79804d9de1e72c Mon Sep 17 00:00:00 2001 From: Thomas E Lackey Date: Wed, 22 May 2024 17:42:28 +0000 Subject: [PATCH] Add messages around the SPA auto-detect. (#828) Tweak the auto-detection logic slightly for single-page apps, and also print the results. Reviewed-on: https://git.vdb.to/cerc-io/stack-orchestrator/pulls/828 Co-authored-by: Thomas E Lackey Co-committed-by: Thomas E Lackey --- .../cerc-webapp-base/scripts/start-serving-app.sh | 14 +++++++++----- 1 file changed, 9 insertions(+), 5 deletions(-) diff --git a/stack_orchestrator/data/container-build/cerc-webapp-base/scripts/start-serving-app.sh b/stack_orchestrator/data/container-build/cerc-webapp-base/scripts/start-serving-app.sh index 4fa1dc03..5358a019 100755 --- a/stack_orchestrator/data/container-build/cerc-webapp-base/scripts/start-serving-app.sh +++ b/stack_orchestrator/data/container-build/cerc-webapp-base/scripts/start-serving-app.sh @@ -9,10 +9,11 @@ CERC_ENABLE_CORS="${CERC_ENABLE_CORS:-false}" CERC_SINGLE_PAGE_APP="${CERC_SINGLE_PAGE_APP}" if [ -z "${CERC_SINGLE_PAGE_APP}" ]; then - if [ 1 -eq $(find "${CERC_WEBAPP_FILES_DIR}" -name '*.html' | wc -l) ] && [ -d "${CERC_WEBAPP_FILES_DIR}/static" ]; then - CERC_SINGLE_PAGE_APP=true - else - CERC_SINGLE_PAGE_APP=false + CERC_SINGLE_PAGE_APP=false + if [ 1 -eq $(find "${CERC_WEBAPP_FILES_DIR}" -name '*.html' | wc -l) ]; then + if [ -d "${CERC_WEBAPP_FILES_DIR}/static" ] || [ -d "${CERC_WEBAPP_FILES_DIR}/assets" ]; then + CERC_SINGLE_PAGE_APP=true + fi fi fi @@ -21,8 +22,11 @@ if [ "true" == "$CERC_ENABLE_CORS" ]; then fi if [ "true" == "$CERC_SINGLE_PAGE_APP" ]; then + echo "Serving content as single-page app. If this is wrong, set 'CERC_SINGLE_PAGE_APP=false'" # Create a catchall redirect back to / CERC_HTTP_EXTRA_ARGS="$CERC_HTTP_EXTRA_ARGS --proxy http://localhost:${CERC_LISTEN_PORT}?" +else + echo "Serving content normally. If this is a single-page app, set 'CERC_SINGLE_PAGE_APP=true'" fi LACONIC_HOSTED_CONFIG_FILE=${LACONIC_HOSTED_CONFIG_FILE} @@ -39,4 +43,4 @@ if [ -f "${LACONIC_HOSTED_CONFIG_FILE}" ]; then fi /scripts/apply-runtime-env.sh ${CERC_WEBAPP_FILES_DIR} -http-server $CERC_HTTP_EXTRA_ARGS -p ${CERC_LISTEN_PORT} "${CERC_WEBAPP_FILES_DIR}" \ No newline at end of file +http-server $CERC_HTTP_EXTRA_ARGS -p ${CERC_LISTEN_PORT} "${CERC_WEBAPP_FILES_DIR}"