From d6ba984a921bb1986b984328e88919aac7dc4ac0 Mon Sep 17 00:00:00 2001 From: Kevin Ngai Date: Wed, 27 Sep 2023 20:33:05 +0000 Subject: [PATCH] Nightly to use default OpenAPI document if cannot be generated --- docker/entrypoint.sh | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/docker/entrypoint.sh b/docker/entrypoint.sh index 3994193c..d9b42e19 100644 --- a/docker/entrypoint.sh +++ b/docker/entrypoint.sh @@ -49,14 +49,18 @@ entry_cmd=${1:-run} # Shorthand (bash) function error() { echo "ERROR: $@" - exit -1 } echo "Trying to generate OpenAPI document with PYGEOAPI_CONFIG=${PYGEOAPI_CONFIG} and PYGEOAPI_OPENAPI=${PYGEOAPI_OPENAPI}..." pygeoapi openapi generate ${PYGEOAPI_CONFIG} --output-file ${PYGEOAPI_OPENAPI} # pygeoapi openapi validate ${PYGEOAPI_OPENAPI} -[[ $? -ne 0 ]] && error "OpenAPI document could not be generated ERROR" +if [ $? -ne 0 ]; then + error "OpenAPI document could not be generated ERROR" + echo "Using default OpenAPI document" + DEFAULT_PYGEOAPI_OPENAPI=`echo $PYGEOAPI_CONFIG | sed 's/deploy\/nightly/deploy/\default/' + cp $DEFAULT_PYGEOAPI_OPENAPI $PYGEOAPI_OPENAPI +fi echo "OpenAPI document generated. continue to pygeoapi..."