* Allow changing the default database name (#50)

* Commented out legacy scripts since it seems they are removed in 2.2
pull/65/head
Tim Sutton 2017-03-27 06:34:38 +02:00 zatwierdzone przez GitHub
rodzic dae0e9a11d
commit b7633a0dc4
2 zmienionych plików z 12 dodań i 6 usunięć

Wyświetl plik

@ -12,7 +12,7 @@ differentiates itself by:
* provides ssl support out of the box
* connections are restricted to the docker subnet
* template_postgis database template is created for you
* a database 'gis' is created for you so you can use this container 'out of the
* a default database 'gis' is created for you so you can use this container 'out of the
box' when it runs with e.g. QGIS
We will work to add more security features to this container in the future with
@ -85,10 +85,11 @@ sudo docker run --name "postgis" -p 25432:5432 -d -t kartoza/postgis
## Environment variables
You can also use the following environment variables to pass a
user name and password.
user name, password and/or default database name.
* -e POSTGRES_USER=<PGUSER>
* -e POSTGRES_PASS=<PGPASSWORD>
* -e POSTGRES_DBNAME=<PGDBNAME>
These will be used to create a new superuser with
your preferred credentials. If these are not specified then the postgresql

Wyświetl plik

@ -55,6 +55,10 @@ fi
if [ -z "$POSTGRES_PASS" ]; then
POSTGRES_PASS=docker
fi
# Set a default database name
if [ -z "$POSTGRES_DBNAME" ]; then
POSTGRES_DBNAME=gis
fi
# Enable hstore and topology by default
if [ -z "$HSTORE" ]; then
HSTORE=true
@ -124,12 +128,13 @@ else
fi
# Needed when importing old dumps using e.g ndims for constraints
echo "Loading legacy sql"
su - postgres -c "psql template_postgis -f $SQLDIR/legacy_minimal.sql"
su - postgres -c "psql template_postgis -f $SQLDIR/legacy_gist.sql"
# commented out these lines since it seems these scripts are removed in Postgis 2.2
#echo "Loading legacy sql"
#su - postgres -c "psql template_postgis -f $SQLDIR/legacy_minimal.sql"
#su - postgres -c "psql template_postgis -f $SQLDIR/legacy_gist.sql"
# Create a default db called 'gis' that you can use to get up and running quickly
# It will be owned by the docker db user
su - postgres -c "createdb -O $POSTGRES_USER -T template_postgis gis"
su - postgres -c "createdb -O $POSTGRES_USER -T template_postgis $POSTGRES_DBNAME"
fi
# This should show up in docker logs afterwards
su - postgres -c "psql -l"