|
|
@ -21,14 +21,25 @@ set -e |
|
|
|
|
|
|
|
if ! [ -f "$LOCAL_DB_PASSFILE" ]; then |
|
|
|
POSTGRES_ROOT_PASSWORD="$(gen_password)" |
|
|
|
|
|
|
|
## required by image of postgres for first run |
|
|
|
server_docker_opts=("${server_docker_opts[@]}" -e POSTGRES_HOST_AUTH_METHOD=trust) |
|
|
|
ddb < <(echo "ALTER USER postgres WITH ENCRYPTED password '$POSTGRES_ROOT_PASSWORD'") |
|
|
|
cat <<EOF > "$LOCAL_DB_PASSFILE" |
|
|
|
*:*:*:postgres:$POSTGRES_ROOT_PASSWORD |
|
|
|
EOF |
|
|
|
chmod 600 "$LOCAL_DB_PASSFILE" |
|
|
|
info "New root password for postgres." |
|
|
|
|
|
|
|
## resetting ``server_docker_opts``, and forcing stop to remove the |
|
|
|
## POSTGRES_HOST_AUTH_METHOD arg. |
|
|
|
docker stop "$container_id" |
|
|
|
docker rm "$container_id" |
|
|
|
server_docker_opts=() |
|
|
|
_set_server_db_params |
|
|
|
fi |
|
|
|
|
|
|
|
|
|
|
|
if ! egrep "^host all all (0.0.0.0/0|all) md5\$" "$PG_HBA" >/dev/null 2>&1; then |
|
|
|
if egrep "^host all all (0.0.0.0/0|all) trust\$" "$PG_HBA" >/dev/null 2>&1; then |
|
|
|
sed -ri 's%^host all all (0\.0\.0\.0/0|all) trust$%host all all \1 md5%g' \ |
|
|
|