diff --git a/Changelog.md b/Changelog.md index b3b91a0..9905c29 100644 --- a/Changelog.md +++ b/Changelog.md @@ -7,6 +7,7 @@ - `PSQL_SSLMODE` config parameter renamed to `REPLICATION_SSLMODE` - defined `/etc/postgresql/certs` as the mountpoint to install SSL key and certificate - added `PG_SSL` parameter to enable/disable SSL support +- `DB_LOCALE` config parameter renamed to `PG_LOCALE` **9.4-2** - added replication options diff --git a/README.md b/README.md index 294d867..b88004b 100644 --- a/README.md +++ b/README.md @@ -148,7 +148,7 @@ docker run --name postgresql -d \ will create a user *dbuser* with the password *dbpass*. It will also create a database named *dbname* and the *dbuser* user will have full access to the *dbname* database. -The `DB_LOCALE` environment variable can be used to configure the locale used for database creation. Its default value is set to C. +The `PG_LOCALE` environment variable can be used to configure the locale used for database creation. Its default value is set to C. The `PG_TRUST_LOCALNET` environment variable can be used to configure postgres to trust connections on the same network. This is handy for other containers to connect without authentication. To enable this behavior, set `PG_TRUST_LOCALNET` to `true`. diff --git a/runtime/env-defaults b/runtime/env-defaults index 4b1eb4c..3cf29fa 100644 --- a/runtime/env-defaults +++ b/runtime/env-defaults @@ -2,6 +2,9 @@ PG_SSL=${PG_SSL:-} +PG_LOCALE=${PG_LOCALE:-$DB_LOCALE} # backward compatibility +PG_LOCALE=${PG_LOCALE:-C} + PG_TRUST_LOCALNET=${PG_TRUST_LOCALNET:-$PSQL_TRUST_LOCALNET} # backward compatibility PG_TRUST_LOCALNET=${PG_TRUST_LOCALNET:-false} @@ -17,5 +20,4 @@ DB_NAME=${DB_NAME:-} DB_USER=${DB_USER:-} DB_PASS=${DB_PASS:-} -DB_LOCALE=${DB_LOCALE:-C} DB_UNACCENT=${DB_UNACCENT:-false} diff --git a/runtime/functions b/runtime/functions index c071280..42b8157 100755 --- a/runtime/functions +++ b/runtime/functions @@ -25,9 +25,9 @@ map_uidgid() { } locale_gen() { - if [[ $DB_LOCALE != C ]]; then - echo "Generating locale \"${DB_LOCALE}\"..." - locale-gen ${DB_LOCALE} >/dev/null + if [[ $PG_LOCALE != C ]]; then + echo "Generating locale \"${PG_LOCALE}\"..." + locale-gen ${PG_LOCALE} >/dev/null fi } @@ -203,7 +203,7 @@ initialize_database() { fi exec_as_postgres ${PG_BINDIR}/initdb --pgdata=${PG_DATADIR} \ - --username=${PG_USER} --encoding=unicode --locale=${DB_LOCALE} --auth=trust >/dev/null + --username=${PG_USER} --encoding=unicode --locale=${PG_LOCALE} --auth=trust >/dev/null if [[ -n ${PG_OLD_VERSION} ]]; then PG_OLD_BINDIR=/usr/lib/postgresql/${PG_OLD_VERSION}/bin