kopia lustrzana https://github.com/kartoza/docker-postgis
Allow changing the default database name (#50)
rodzic
dae0e9a11d
commit
9b3c6a7dbd
|
@ -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
|
||||
|
|
|
@ -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
|
||||
|
@ -129,7 +133,7 @@ else
|
|||
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"
|
||||
|
|
Ładowanie…
Reference in New Issue