Overwrite pg_hba.conf entirely to ensure no hostssl exists

This commit is contained in:
2026-08-11 12:58:13 +05:30
parent 1deaefde7f
commit 9458176f88
+2 -2
View File
@@ -6,7 +6,7 @@ services:
POSTGRES_USER: admin POSTGRES_USER: admin
POSTGRES_PASSWORD: password POSTGRES_PASSWORD: password
POSTGRES_DB: sop_monitoring POSTGRES_DB: sop_monitoring
FORCE_RESTART: 2 FORCE_RESTART: 3
ports: ports:
- "5432:5432" - "5432:5432"
volumes: volumes:
@@ -19,7 +19,7 @@ services:
volumes: volumes:
- pgdata:/var/lib/postgresql/data - pgdata:/var/lib/postgresql/data
command: > command: >
sh -c "find /var/lib/postgresql/data -name pg_hba.conf -exec sed -i 's/hostssl/host/g' {} + || true; find /var/lib/postgresql/data -name pg_hba.conf -exec sh -c 'echo \"host all all all md5\" >> \"$1\"; echo \"host all all all scram-sha-256\" >> \"$1\"' _ {} \;" sh -c "find /var/lib/postgresql/data -name pg_hba.conf -exec sh -c 'echo \"local all all trust\" > \"$1\"; echo \"host all all 127.0.0.1/32 trust\" >> \"$1\"; echo \"host all all ::1/128 trust\" >> \"$1\"; echo \"host all all all md5\" >> \"$1\"; echo \"host all all all scram-sha-256\" >> \"$1\"' _ {} \;"
api: api: