Add messages around the SPA auto-detect. (#828)
All checks were successful
Lint Checks / Run linter (push) Successful in 45s
Publish / Build and publish (push) Successful in 1m28s
Deploy Test / Run deploy test suite (push) Successful in 4m35s
Webapp Test / Run webapp test suite (push) Successful in 4m55s
Smoke Test / Run basic test suite (push) Successful in 4m55s
Database Test / Run database hosting test on kind/k8s (push) Successful in 11m48s

Tweak the auto-detection logic slightly for single-page apps, and also print the results.

Reviewed-on: #828
Co-authored-by: Thomas E Lackey <telackey@bozemanpass.com>
Co-committed-by: Thomas E Lackey <telackey@bozemanpass.com>
This commit is contained in:
Thomas E Lackey 2024-05-22 17:42:28 +00:00 committed by Thomas E Lackey
parent 8f2da38183
commit 855288368c

View File

@ -9,10 +9,11 @@ CERC_ENABLE_CORS="${CERC_ENABLE_CORS:-false}"
CERC_SINGLE_PAGE_APP="${CERC_SINGLE_PAGE_APP}" CERC_SINGLE_PAGE_APP="${CERC_SINGLE_PAGE_APP}"
if [ -z "${CERC_SINGLE_PAGE_APP}" ]; then 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
fi fi
@ -21,8 +22,11 @@ if [ "true" == "$CERC_ENABLE_CORS" ]; then
fi fi
if [ "true" == "$CERC_SINGLE_PAGE_APP" ]; then 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 / # Create a catchall redirect back to /
CERC_HTTP_EXTRA_ARGS="$CERC_HTTP_EXTRA_ARGS --proxy http://localhost:${CERC_LISTEN_PORT}?" 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 fi
LACONIC_HOSTED_CONFIG_FILE=${LACONIC_HOSTED_CONFIG_FILE} LACONIC_HOSTED_CONFIG_FILE=${LACONIC_HOSTED_CONFIG_FILE}