Skip to content

Commit

Permalink
Nightly to use default OpenAPI document if cannot be generated (#310)
Browse files Browse the repository at this point in the history
- Add more verbose echo

Co-authored-by: Kevin Ngai <afswken@geomet-dev-21.cmc.ec.gc.ca>
  • Loading branch information
kngai and Kevin Ngai authored Oct 4, 2023
1 parent 66bb1a3 commit 4f7219f
Showing 1 changed file with 6 additions and 2 deletions.
8 changes: 6 additions & 2 deletions docker/entrypoint.sh
Original file line number Diff line number Diff line change
Expand Up @@ -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"
DEFAULT_PYGEOAPI_OPENAPI=`echo ${PYGEOAPI_OPENAPI} | sed 's|deploy/nightly|deploy/default|'`
echo "Using default OpenAPI document with DEFAULT_PYGEOAPI_OPENAPI=${DEFAULT_PYGEOAPI_OPENAPI}"
cp ${DEFAULT_PYGEOAPI_OPENAPI} ${PYGEOAPI_OPENAPI}
fi

echo "OpenAPI document generated. continue to pygeoapi..."

Expand Down

0 comments on commit 4f7219f

Please sign in to comment.