diff --git a/Changelog.md b/Changelog.md index 8614d00..46518d9 100644 --- a/Changelog.md +++ b/Changelog.md @@ -2,6 +2,7 @@ **latest** - complete rewrite +- `PSQL_TRUST_LOCALNET` config parameter renamed to `PG_TRUST_LOCALNET` **9.4-2** - added replication options diff --git a/README.md b/README.md index 5e526c7..5eadc87 100644 --- a/README.md +++ b/README.md @@ -150,13 +150,13 @@ will create a user *dbuser* with the password *dbpass*. It will also create a da The `DB_LOCALE` environment variable can be used to configure the locale used for database creation. Its default value is set to C. -The `PSQL_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 `PSQL_TRUST_LOCALNET` to `true`. +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`. For example, ```bash docker run --name postgresql -d \ - -e 'PSQL_TRUST_LOCALNET=true' \ + -e 'PG_TRUST_LOCALNET=true' \ sameersbn/postgresql:9.4-8 ``` @@ -176,7 +176,7 @@ Create a master instance ```bash docker run --name='psql-master' -it --rm \ - -e 'PSQL_MODE=master' -e 'PSQL_TRUST_LOCALNET=true' \ + -e 'PSQL_MODE=master' -e 'PG_TRUST_LOCALNET=true' \ -e 'REPLICATION_USER=replicator' -e 'REPLICATION_PASS=replicatorpass' \ -e 'DB_NAME=dbname' -e 'DB_USER=dbuser' -e 'DB_PASS=dbpass' \ sameersbn/postgresql:9.4-8 @@ -187,7 +187,7 @@ Create a streaming replication instance ```bash docker run --name='psql-slave' -it --rm \ --link psql-master:psql-master \ - -e 'PSQL_MODE=slave' -e 'PSQL_TRUST_LOCALNET=true' \ + -e 'PSQL_MODE=slave' -e 'PG_TRUST_LOCALNET=true' \ -e 'REPLICATION_HOST=psql-master' -e 'REPLICATION_PORT=5432' \ -e 'REPLICATION_USER=replicator' -e 'REPLICATION_PASS=replicatorpass' \ sameersbn/postgresql:9.4-8 diff --git a/entrypoint.sh b/entrypoint.sh index 6dbfe6a..c808ed8 100755 --- a/entrypoint.sh +++ b/entrypoint.sh @@ -3,7 +3,9 @@ set -e PSQL_MODE=${PSQL_MODE:-} PSQL_SSLMODE=${PSQL_SSLMODE:-} -PSQL_TRUST_LOCALNET=${PSQL_TRUST_LOCALNET:-false} + +PG_TRUST_LOCALNET=${PG_TRUST_LOCALNET:-$PSQL_TRUST_LOCALNET} # backward compatibility +PG_TRUST_LOCALNET=${PG_TRUST_LOCALNET:-false} REPLICATION_USER=${REPLICATION_USER:-} REPLICATION_PASS=${REPLICATION_PASS:-} @@ -229,7 +231,7 @@ initialize_database() { } trust_localnet() { - if [[ ${PSQL_TRUST_LOCALNET} == true ]]; then + if [[ ${PG_TRUST_LOCALNET} == true ]]; then echo "Trusting connections from the local network..." set_hba_param "host all all samenet trust" fi