mirror of
https://github.com/EpicMorg/docker-scripts.git
synced 2024-12-29 16:15:45 +03:00
25 lines
481 B
Bash
Executable File
25 lines
481 B
Bash
Executable File
#!/bin/bash
|
|
set -e
|
|
|
|
if [ "$1" = 'postgres' ]; then
|
|
chown -R postgres "$PGDATA"
|
|
|
|
if [ -z "$(ls -A "$PGDATA")" ]; then
|
|
gosu postgres initdb
|
|
|
|
sed -ri "s/^#(listen_addresses\s*=\s*)\S+/\1'*'/" "$PGDATA"/postgresql.conf
|
|
|
|
{ echo; echo 'host all all 0.0.0.0/0 trust'; } >> "$PGDATA"/pg_hba.conf
|
|
|
|
if [ -d /docker-entrypoint-initdb.d ]; then
|
|
for f in /docker-entrypoint-initdb.d/*.sh; do
|
|
[ -f "$f" ] && . "$f"
|
|
done
|
|
fi
|
|
fi
|
|
|
|
exec gosu postgres "$@"
|
|
fi
|
|
|
|
exec "$@"
|