kopia lustrzana https://github.com/kartoza/docker-postgis
Extensions in template1 added (#182)
* Enable extensions in template1 Env variable POSTGRES_TEMPLATE_EXTENSIONS added. If set to true, extensions will also be created in template1 database. This is useful for frameworks like Django where test databases are build every time by using the template. * Echo of env variable removed * Update README.md Added POSTGRES_TEMPLATE_EXTENSIONS to Environment variables section in the description.pull/183/head
rodzic
f3734fcfed
commit
901e08cf33
|
@ -114,6 +114,9 @@ user name, password and/or default database name(or multiple databases comma sep
|
|||
* -e DEFAULT_ENCODING="UTF8"
|
||||
* -e DEFAULT_COLLATION="en_US.UTF-8"
|
||||
* -e DEFAULT_CTYPE="en_US.UTF-8"
|
||||
|
||||
Specifies whether extensions will also be installed in template1 database.
|
||||
* -e POSTGRES_TEMPLATE_EXTENSIONS=true
|
||||
|
||||
Maximum size to let the WAL grow to between automatic WAL checkpoints.
|
||||
* -e WAL_SIZE=4GB
|
||||
|
|
|
@ -43,6 +43,13 @@ echo "postgres ready"
|
|||
# Setup user
|
||||
source /setup-user.sh
|
||||
|
||||
# enable extensions in template1 if env variable set to true
|
||||
if [ "$POSTGRES_TEMPLATE_EXTENSIONS" = true ] ; then
|
||||
for ext in $(echo ${POSTGRES_MULTIPLE_EXTENSIONS} | tr ',' ' '); do
|
||||
echo "Enabling ${ext} in the database template1"
|
||||
su - postgres -c "psql -c 'CREATE EXTENSION IF NOT EXISTS ${ext} cascade;' template1"
|
||||
done
|
||||
fi
|
||||
|
||||
# Create a default db called 'gis' or $POSTGRES_DBNAME that you can use to get up and running quickly
|
||||
# It will be owned by the docker db user
|
||||
|
|
Ładowanie…
Reference in New Issue