forked from cerc-io/stack-orchestrator
Make the SPA detection even simpler. (#830)
Reviewed-on: cerc-io/stack-orchestrator#830 Co-authored-by: Thomas E Lackey <telackey@bozemanpass.com> Co-committed-by: Thomas E Lackey <telackey@bozemanpass.com>
This commit is contained in:
parent
25d0bc8a98
commit
579b402f2f
@ -8,19 +8,19 @@ CERC_WEBAPP_FILES_DIR="${CERC_WEBAPP_FILES_DIR:-/data}"
|
|||||||
CERC_ENABLE_CORS="${CERC_ENABLE_CORS:-false}"
|
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}" ] && [ 1 -eq $(find "${CERC_WEBAPP_FILES_DIR}" -name '*.html' | wc -l) ]; then
|
||||||
CERC_SINGLE_PAGE_APP=false
|
# If there only one HTML file, we assume an SPA.
|
||||||
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
|
CERC_SINGLE_PAGE_APP=true
|
||||||
fi
|
else
|
||||||
fi
|
CERC_SINGLE_PAGE_APP=false
|
||||||
fi
|
fi
|
||||||
|
|
||||||
|
# ${var,,} is a lower-case comparison
|
||||||
if [ "true" == "${CERC_ENABLE_CORS,,}" ]; then
|
if [ "true" == "${CERC_ENABLE_CORS,,}" ]; then
|
||||||
CERC_HTTP_EXTRA_ARGS="$CERC_HTTP_EXTRA_ARGS --cors"
|
CERC_HTTP_EXTRA_ARGS="$CERC_HTTP_EXTRA_ARGS --cors"
|
||||||
fi
|
fi
|
||||||
|
|
||||||
|
# ${var,,} is a lower-case comparison
|
||||||
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'"
|
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 /
|
||||||
|
Loading…
Reference in New Issue
Block a user