From 06a1869bee0334704fc697afe912025a6ce90073 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Benjamin=20B=C3=B6hmke?= Date: Tue, 12 Jun 2018 15:39:54 +0200 Subject: [PATCH] postgres extension configurable --- README.md | 1 + entrypoint.sh | 7 +++++-- 2 files changed, 6 insertions(+), 2 deletions(-) diff --git a/README.md b/README.md index e2ce1dc..fedc4ee 100644 --- a/README.md +++ b/README.md @@ -52,3 +52,4 @@ Available Configuration Parameters - **DB_USER**: User to create with access to `DB_DATABASE` - **DB_PASSWORD**: Password of `DB_USER` - **BACKUP_SCHEDULE**: If set an SQL dump of the database is created automatically all `15min`, `hourly`, `daily`, `weekly` or `monthly` +- **PG_EXTENSIONS**: List of postgres extensions (only for postgresql) diff --git a/entrypoint.sh b/entrypoint.sh index 237915c..945d65c 100755 --- a/entrypoint.sh +++ b/entrypoint.sh @@ -90,8 +90,11 @@ postgresql_init() { psql -h$DB_HOST -p $DB_PORT -U$DB_ROOT_USER -tc "GRANT ALL PRIVILEGES ON DATABASE $DB_DATABASE to $DB_USER;" > /dev/null - # TODO make this configurable - psql -h$DB_HOST -p $DB_PORT -U$DB_ROOT_USER -d $DB_DATABASE -tc "CREATE EXTENSION pg_trgm;" > /dev/null 2> /dev/null || true + + # add extension + if [ -n "$PG_EXTENSIONS" ]; then + psql -h$DB_HOST -p $DB_PORT -U$DB_ROOT_USER -d $DB_DATABASE -tc "CREATE EXTENSION $PG_EXTENSIONS;" > /dev/null 2> /dev/null || true + fi } postgresql_auto_backup() {