diff --git a/README.md b/README.md index d25145e..2f3ee11 100644 --- a/README.md +++ b/README.md @@ -200,6 +200,17 @@ docker run --name postgresql -itd \ sameersbn/postgresql:9.4-11 ``` +Additionally, creation of PostGIS topology extension can be enabled by specifying `DB_POSTGIS_TOPOLOGY=true`: + + +```bash +docker run --name postgresql -itd \ + --env 'DB_NAME=dbname' --env 'DB_POSTGIS=true' --env DB_POSTGIS_TOPOLOGY=true \ + sameersbn/postgresql:9.4-11 +``` + +Note that topology extension creation can be enabled only when PostGIS extension is enabled. + *By default the PostGIS extension is disabled* ## Granting user access to a database diff --git a/runtime/env-defaults b/runtime/env-defaults index 854e1c5..6b92ba6 100644 --- a/runtime/env-defaults +++ b/runtime/env-defaults @@ -20,3 +20,4 @@ DB_TEMPLATE=${DB_TEMPLATE:-template1} DB_UNACCENT=${DB_UNACCENT:-false} DB_POSTGIS=${DB_POSTGIS:-false} +DB_POSTGIS_TOPOLOGY=${DB_POSTGIS_TOPOLOGY:-false} diff --git a/runtime/functions b/runtime/functions index e5314b3..e5b368a 100755 --- a/runtime/functions +++ b/runtime/functions @@ -326,7 +326,10 @@ create_database() { if [[ ${DB_POSTGIS} == true ]]; then echo "‣ Loading PostGIS extension..." psql -U ${PG_USER} -d ${database} -c "CREATE EXTENSION IF NOT EXISTS postgis;" >/dev/null 2>&1 - psql -U ${PG_USER} -d ${database} -c "CREATE EXTENSION IF NOT EXISTS postgis_topology;" >/dev/null 2>&1 + if [[ ${DB_POSTGIS_TOPOLOGY} == true ]]; then + echo "‣ Loading PostGIS Topology extension..." + psql -U ${PG_USER} -d ${database} -c "CREATE EXTENSION IF NOT EXISTS postgis_topology;" >/dev/null 2>&1 + fi fi if [[ -n ${DB_USER} ]]; then