mirror of
https://github.com/wassname/docker-postgresql.git
synced 2026-08-20 12:20:06 +08:00
PSQL_TRUST_LOCALNET config parameter renamed to PG_TRUST_LOCALNET
This commit is contained in:
@@ -2,6 +2,7 @@
|
|||||||
|
|
||||||
**latest**
|
**latest**
|
||||||
- complete rewrite
|
- complete rewrite
|
||||||
|
- `PSQL_TRUST_LOCALNET` config parameter renamed to `PG_TRUST_LOCALNET`
|
||||||
|
|
||||||
**9.4-2**
|
**9.4-2**
|
||||||
- added replication options
|
- added replication options
|
||||||
|
|||||||
@@ -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 `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,
|
For example,
|
||||||
|
|
||||||
```bash
|
```bash
|
||||||
docker run --name postgresql -d \
|
docker run --name postgresql -d \
|
||||||
-e 'PSQL_TRUST_LOCALNET=true' \
|
-e 'PG_TRUST_LOCALNET=true' \
|
||||||
sameersbn/postgresql:9.4-8
|
sameersbn/postgresql:9.4-8
|
||||||
```
|
```
|
||||||
|
|
||||||
@@ -176,7 +176,7 @@ Create a master instance
|
|||||||
|
|
||||||
```bash
|
```bash
|
||||||
docker run --name='psql-master' -it --rm \
|
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 'REPLICATION_USER=replicator' -e 'REPLICATION_PASS=replicatorpass' \
|
||||||
-e 'DB_NAME=dbname' -e 'DB_USER=dbuser' -e 'DB_PASS=dbpass' \
|
-e 'DB_NAME=dbname' -e 'DB_USER=dbuser' -e 'DB_PASS=dbpass' \
|
||||||
sameersbn/postgresql:9.4-8
|
sameersbn/postgresql:9.4-8
|
||||||
@@ -187,7 +187,7 @@ Create a streaming replication instance
|
|||||||
```bash
|
```bash
|
||||||
docker run --name='psql-slave' -it --rm \
|
docker run --name='psql-slave' -it --rm \
|
||||||
--link psql-master:psql-master \
|
--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_HOST=psql-master' -e 'REPLICATION_PORT=5432' \
|
||||||
-e 'REPLICATION_USER=replicator' -e 'REPLICATION_PASS=replicatorpass' \
|
-e 'REPLICATION_USER=replicator' -e 'REPLICATION_PASS=replicatorpass' \
|
||||||
sameersbn/postgresql:9.4-8
|
sameersbn/postgresql:9.4-8
|
||||||
|
|||||||
+4
-2
@@ -3,7 +3,9 @@ set -e
|
|||||||
|
|
||||||
PSQL_MODE=${PSQL_MODE:-}
|
PSQL_MODE=${PSQL_MODE:-}
|
||||||
PSQL_SSLMODE=${PSQL_SSLMODE:-}
|
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_USER=${REPLICATION_USER:-}
|
||||||
REPLICATION_PASS=${REPLICATION_PASS:-}
|
REPLICATION_PASS=${REPLICATION_PASS:-}
|
||||||
@@ -229,7 +231,7 @@ initialize_database() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
trust_localnet() {
|
trust_localnet() {
|
||||||
if [[ ${PSQL_TRUST_LOCALNET} == true ]]; then
|
if [[ ${PG_TRUST_LOCALNET} == true ]]; then
|
||||||
echo "Trusting connections from the local network..."
|
echo "Trusting connections from the local network..."
|
||||||
set_hba_param "host all all samenet trust"
|
set_hba_param "host all all samenet trust"
|
||||||
fi
|
fi
|
||||||
|
|||||||
Reference in New Issue
Block a user