We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent 6bebca2 commit de19732Copy full SHA for de19732
docker-entrypoint.d/10-fix-pg_hba.sh
@@ -8,6 +8,7 @@ else
8
authMethod=trust
9
fi
10
11
+# Fix pg_hba.conf
12
if grep -q "^host all all 0.0.0.0/0 " "$PGDATA/pg_hba.conf"; then
13
if grep -q "^host all all 0.0.0.0/0 $authMethod$" "$PGDATA/pg_hba.conf"; then
14
echo "pg_hba.conf already valid"
@@ -18,3 +19,11 @@ else
18
19
{ echo; echo "host all all 0.0.0.0/0 $authMethod"; } >> "$PGDATA/pg_hba.conf"
20
21
22
+# Fix user password
23
+if psql -U postgres -c "SELECT COUNT(*) AS count FROM pg_catalog.pg_user WHERE usename = '$POSTGRES_USER'" | grep -q 1; then
24
+ op="ALTER"
25
+else
26
+ op="CREATE"
27
+fi
28
+
29
+psql -Upostgres -c "$op USER \"$POSTGRES_USER\" WITH SUPERUSER $pass ;"
0 commit comments