diff --git a/README.md b/README.md index 80b4763..67c96d4 100644 --- a/README.md +++ b/README.md @@ -42,6 +42,16 @@ The `vrt.sh` script is meant to be called regularly via a Cronjob (every 5 hours or more, as the datasets will be downloaded and published again at each run), with the previous variables defined. +## Optional variables + +The following environment variables are optional: + +``` +# export ACTIVATE_GEOMETRY_TYPE=false +True by default +``` + + # Docker The provided `Dockerfile` is meant to build the `vrt-bot` image, and a build can be diff --git a/vrt.sh b/vrt.sh index 99ec377..e70ced4 100755 --- a/vrt.sh +++ b/vrt.sh @@ -31,6 +31,10 @@ touch ${SOURCEDIR}/vrtbot.log then cd "${SOURCEDIR}" + params=() + if [[ ${ACTIVATE_GEOMETRY_TYPE:-true} == true ]]; then + params=(-nlt PROMOTE_TO_MULTI) + fi # cycle vrt for vrt in *.vrt; do @@ -38,7 +42,7 @@ touch ${SOURCEDIR}/vrtbot.log /usr/bin/ogr2ogr \ -f Postgresql \ -overwrite \ - PG:"active_schema=${ACTIVESCHEMA}" "${vrt}" -lco SCHEMA=${ACTIVESCHEMA} -lco OVERWRITE=yes -lco GEOMETRY_NAME=geometry -nlt PROMOTE_TO_MULTI -lco DESCRIPTION="import par ${JOB_NAME}/${BUILD_NUMBER} le ${DATE} - ${SOURCEDIR}/${vrt}" 2>&1 | tee -a vrtbot.log + PG:"active_schema=${ACTIVESCHEMA}" "${vrt}" -lco SCHEMA=${ACTIVESCHEMA} -lco OVERWRITE=yes -lco GEOMETRY_NAME=geometry "${params[@]}" -lco DESCRIPTION="import par ${JOB_NAME}/${BUILD_NUMBER} le ${DATE} - ${SOURCEDIR}/${vrt}" 2>&1 | tee -a vrtbot.log # post import sql if [ -f "${vrt}.sql" ]; then echo "script sql après import trouvé" | tee -a vrtbot.log