You've already forked postgres
mirror of
https://github.com/docker-library/postgres.git
synced 2025-07-28 10:42:06 +03:00
Fixes from tianon's review
This commit is contained in:
@ -34,7 +34,7 @@ _is_sourced() {
|
|||||||
|
|
||||||
# used to create initial posgres directories and if run as root, ensure ownership to the "postgres" user
|
# used to create initial posgres directories and if run as root, ensure ownership to the "postgres" user
|
||||||
docker_create_db_directories() {
|
docker_create_db_directories() {
|
||||||
local user="$(id -u)"
|
local user; user="$(id -u)"
|
||||||
|
|
||||||
mkdir -p "$PGDATA"
|
mkdir -p "$PGDATA"
|
||||||
chmod 700 "$PGDATA"
|
chmod 700 "$PGDATA"
|
||||||
@ -46,7 +46,9 @@ docker_create_db_directories() {
|
|||||||
# Create the transaction log directory before initdb is run so the directory is owned by the correct user
|
# Create the transaction log directory before initdb is run so the directory is owned by the correct user
|
||||||
if [ "$POSTGRES_INITDB_WALDIR" ]; then
|
if [ "$POSTGRES_INITDB_WALDIR" ]; then
|
||||||
mkdir -p "$POSTGRES_INITDB_WALDIR"
|
mkdir -p "$POSTGRES_INITDB_WALDIR"
|
||||||
[ "$user" = '0' ] && find "$POSTGRES_INITDB_WALDIR" \! -user postgres - exec chown postgres '{}' +
|
if [ "$user" = '0' ]; then
|
||||||
|
find "$POSTGRES_INITDB_WALDIR" \! -user postgres -exec chown postgres '{}' +
|
||||||
|
fi
|
||||||
chmod 700 "$POSTGRES_INITDB_WALDIR"
|
chmod 700 "$POSTGRES_INITDB_WALDIR"
|
||||||
fi
|
fi
|
||||||
|
|
||||||
@ -193,10 +195,8 @@ docker_setup_env() {
|
|||||||
|
|
||||||
# append md5 or trust auth to pg_hba.conf based on existence of POSTGRES_PASSWORD
|
# append md5 or trust auth to pg_hba.conf based on existence of POSTGRES_PASSWORD
|
||||||
pg_setup_hba_conf() {
|
pg_setup_hba_conf() {
|
||||||
local authMethod
|
local authMethod='md5'
|
||||||
if [ "$POSTGRES_PASSWORD" ]; then
|
if [ -z "$POSTGRES_PASSWORD" ]; then
|
||||||
authMethod='md5'
|
|
||||||
else
|
|
||||||
authMethod='trust'
|
authMethod='trust'
|
||||||
fi
|
fi
|
||||||
|
|
||||||
@ -232,7 +232,6 @@ _main() {
|
|||||||
set -- postgres "$@"
|
set -- postgres "$@"
|
||||||
fi
|
fi
|
||||||
|
|
||||||
|
|
||||||
if [ "$1" = 'postgres' ]; then
|
if [ "$1" = 'postgres' ]; then
|
||||||
docker_setup_env
|
docker_setup_env
|
||||||
# setup data directories and permissions (when run as root)
|
# setup data directories and permissions (when run as root)
|
||||||
|
@ -34,7 +34,7 @@ _is_sourced() {
|
|||||||
|
|
||||||
# used to create initial posgres directories and if run as root, ensure ownership to the "postgres" user
|
# used to create initial posgres directories and if run as root, ensure ownership to the "postgres" user
|
||||||
docker_create_db_directories() {
|
docker_create_db_directories() {
|
||||||
local user="$(id -u)"
|
local user; user="$(id -u)"
|
||||||
|
|
||||||
mkdir -p "$PGDATA"
|
mkdir -p "$PGDATA"
|
||||||
chmod 700 "$PGDATA"
|
chmod 700 "$PGDATA"
|
||||||
@ -46,7 +46,9 @@ docker_create_db_directories() {
|
|||||||
# Create the transaction log directory before initdb is run so the directory is owned by the correct user
|
# Create the transaction log directory before initdb is run so the directory is owned by the correct user
|
||||||
if [ "$POSTGRES_INITDB_WALDIR" ]; then
|
if [ "$POSTGRES_INITDB_WALDIR" ]; then
|
||||||
mkdir -p "$POSTGRES_INITDB_WALDIR"
|
mkdir -p "$POSTGRES_INITDB_WALDIR"
|
||||||
[ "$user" = '0' ] && find "$POSTGRES_INITDB_WALDIR" \! -user postgres - exec chown postgres '{}' +
|
if [ "$user" = '0' ]; then
|
||||||
|
find "$POSTGRES_INITDB_WALDIR" \! -user postgres -exec chown postgres '{}' +
|
||||||
|
fi
|
||||||
chmod 700 "$POSTGRES_INITDB_WALDIR"
|
chmod 700 "$POSTGRES_INITDB_WALDIR"
|
||||||
fi
|
fi
|
||||||
|
|
||||||
@ -193,10 +195,8 @@ docker_setup_env() {
|
|||||||
|
|
||||||
# append md5 or trust auth to pg_hba.conf based on existence of POSTGRES_PASSWORD
|
# append md5 or trust auth to pg_hba.conf based on existence of POSTGRES_PASSWORD
|
||||||
pg_setup_hba_conf() {
|
pg_setup_hba_conf() {
|
||||||
local authMethod
|
local authMethod='md5'
|
||||||
if [ "$POSTGRES_PASSWORD" ]; then
|
if [ -z "$POSTGRES_PASSWORD" ]; then
|
||||||
authMethod='md5'
|
|
||||||
else
|
|
||||||
authMethod='trust'
|
authMethod='trust'
|
||||||
fi
|
fi
|
||||||
|
|
||||||
@ -232,7 +232,6 @@ _main() {
|
|||||||
set -- postgres "$@"
|
set -- postgres "$@"
|
||||||
fi
|
fi
|
||||||
|
|
||||||
|
|
||||||
if [ "$1" = 'postgres' ]; then
|
if [ "$1" = 'postgres' ]; then
|
||||||
docker_setup_env
|
docker_setup_env
|
||||||
# setup data directories and permissions (when run as root)
|
# setup data directories and permissions (when run as root)
|
||||||
|
@ -34,7 +34,7 @@ _is_sourced() {
|
|||||||
|
|
||||||
# used to create initial posgres directories and if run as root, ensure ownership to the "postgres" user
|
# used to create initial posgres directories and if run as root, ensure ownership to the "postgres" user
|
||||||
docker_create_db_directories() {
|
docker_create_db_directories() {
|
||||||
local user="$(id -u)"
|
local user; user="$(id -u)"
|
||||||
|
|
||||||
mkdir -p "$PGDATA"
|
mkdir -p "$PGDATA"
|
||||||
chmod 700 "$PGDATA"
|
chmod 700 "$PGDATA"
|
||||||
@ -46,7 +46,9 @@ docker_create_db_directories() {
|
|||||||
# Create the transaction log directory before initdb is run so the directory is owned by the correct user
|
# Create the transaction log directory before initdb is run so the directory is owned by the correct user
|
||||||
if [ "$POSTGRES_INITDB_WALDIR" ]; then
|
if [ "$POSTGRES_INITDB_WALDIR" ]; then
|
||||||
mkdir -p "$POSTGRES_INITDB_WALDIR"
|
mkdir -p "$POSTGRES_INITDB_WALDIR"
|
||||||
[ "$user" = '0' ] && find "$POSTGRES_INITDB_WALDIR" \! -user postgres - exec chown postgres '{}' +
|
if [ "$user" = '0' ]; then
|
||||||
|
find "$POSTGRES_INITDB_WALDIR" \! -user postgres -exec chown postgres '{}' +
|
||||||
|
fi
|
||||||
chmod 700 "$POSTGRES_INITDB_WALDIR"
|
chmod 700 "$POSTGRES_INITDB_WALDIR"
|
||||||
fi
|
fi
|
||||||
|
|
||||||
@ -193,10 +195,8 @@ docker_setup_env() {
|
|||||||
|
|
||||||
# append md5 or trust auth to pg_hba.conf based on existence of POSTGRES_PASSWORD
|
# append md5 or trust auth to pg_hba.conf based on existence of POSTGRES_PASSWORD
|
||||||
pg_setup_hba_conf() {
|
pg_setup_hba_conf() {
|
||||||
local authMethod
|
local authMethod='md5'
|
||||||
if [ "$POSTGRES_PASSWORD" ]; then
|
if [ -z "$POSTGRES_PASSWORD" ]; then
|
||||||
authMethod='md5'
|
|
||||||
else
|
|
||||||
authMethod='trust'
|
authMethod='trust'
|
||||||
fi
|
fi
|
||||||
|
|
||||||
@ -232,7 +232,6 @@ _main() {
|
|||||||
set -- postgres "$@"
|
set -- postgres "$@"
|
||||||
fi
|
fi
|
||||||
|
|
||||||
|
|
||||||
if [ "$1" = 'postgres' ]; then
|
if [ "$1" = 'postgres' ]; then
|
||||||
docker_setup_env
|
docker_setup_env
|
||||||
# setup data directories and permissions (when run as root)
|
# setup data directories and permissions (when run as root)
|
||||||
|
@ -34,7 +34,7 @@ _is_sourced() {
|
|||||||
|
|
||||||
# used to create initial posgres directories and if run as root, ensure ownership to the "postgres" user
|
# used to create initial posgres directories and if run as root, ensure ownership to the "postgres" user
|
||||||
docker_create_db_directories() {
|
docker_create_db_directories() {
|
||||||
local user="$(id -u)"
|
local user; user="$(id -u)"
|
||||||
|
|
||||||
mkdir -p "$PGDATA"
|
mkdir -p "$PGDATA"
|
||||||
chmod 700 "$PGDATA"
|
chmod 700 "$PGDATA"
|
||||||
@ -46,7 +46,9 @@ docker_create_db_directories() {
|
|||||||
# Create the transaction log directory before initdb is run so the directory is owned by the correct user
|
# Create the transaction log directory before initdb is run so the directory is owned by the correct user
|
||||||
if [ "$POSTGRES_INITDB_WALDIR" ]; then
|
if [ "$POSTGRES_INITDB_WALDIR" ]; then
|
||||||
mkdir -p "$POSTGRES_INITDB_WALDIR"
|
mkdir -p "$POSTGRES_INITDB_WALDIR"
|
||||||
[ "$user" = '0' ] && find "$POSTGRES_INITDB_WALDIR" \! -user postgres - exec chown postgres '{}' +
|
if [ "$user" = '0' ]; then
|
||||||
|
find "$POSTGRES_INITDB_WALDIR" \! -user postgres -exec chown postgres '{}' +
|
||||||
|
fi
|
||||||
chmod 700 "$POSTGRES_INITDB_WALDIR"
|
chmod 700 "$POSTGRES_INITDB_WALDIR"
|
||||||
fi
|
fi
|
||||||
|
|
||||||
@ -193,10 +195,8 @@ docker_setup_env() {
|
|||||||
|
|
||||||
# append md5 or trust auth to pg_hba.conf based on existence of POSTGRES_PASSWORD
|
# append md5 or trust auth to pg_hba.conf based on existence of POSTGRES_PASSWORD
|
||||||
pg_setup_hba_conf() {
|
pg_setup_hba_conf() {
|
||||||
local authMethod
|
local authMethod='md5'
|
||||||
if [ "$POSTGRES_PASSWORD" ]; then
|
if [ -z "$POSTGRES_PASSWORD" ]; then
|
||||||
authMethod='md5'
|
|
||||||
else
|
|
||||||
authMethod='trust'
|
authMethod='trust'
|
||||||
fi
|
fi
|
||||||
|
|
||||||
@ -232,7 +232,6 @@ _main() {
|
|||||||
set -- postgres "$@"
|
set -- postgres "$@"
|
||||||
fi
|
fi
|
||||||
|
|
||||||
|
|
||||||
if [ "$1" = 'postgres' ]; then
|
if [ "$1" = 'postgres' ]; then
|
||||||
docker_setup_env
|
docker_setup_env
|
||||||
# setup data directories and permissions (when run as root)
|
# setup data directories and permissions (when run as root)
|
||||||
|
@ -34,7 +34,7 @@ _is_sourced() {
|
|||||||
|
|
||||||
# used to create initial posgres directories and if run as root, ensure ownership to the "postgres" user
|
# used to create initial posgres directories and if run as root, ensure ownership to the "postgres" user
|
||||||
docker_create_db_directories() {
|
docker_create_db_directories() {
|
||||||
local user="$(id -u)"
|
local user; user="$(id -u)"
|
||||||
|
|
||||||
mkdir -p "$PGDATA"
|
mkdir -p "$PGDATA"
|
||||||
chmod 700 "$PGDATA"
|
chmod 700 "$PGDATA"
|
||||||
@ -46,7 +46,9 @@ docker_create_db_directories() {
|
|||||||
# Create the transaction log directory before initdb is run so the directory is owned by the correct user
|
# Create the transaction log directory before initdb is run so the directory is owned by the correct user
|
||||||
if [ "$POSTGRES_INITDB_WALDIR" ]; then
|
if [ "$POSTGRES_INITDB_WALDIR" ]; then
|
||||||
mkdir -p "$POSTGRES_INITDB_WALDIR"
|
mkdir -p "$POSTGRES_INITDB_WALDIR"
|
||||||
[ "$user" = '0' ] && find "$POSTGRES_INITDB_WALDIR" \! -user postgres - exec chown postgres '{}' +
|
if [ "$user" = '0' ]; then
|
||||||
|
find "$POSTGRES_INITDB_WALDIR" \! -user postgres -exec chown postgres '{}' +
|
||||||
|
fi
|
||||||
chmod 700 "$POSTGRES_INITDB_WALDIR"
|
chmod 700 "$POSTGRES_INITDB_WALDIR"
|
||||||
fi
|
fi
|
||||||
|
|
||||||
@ -193,10 +195,8 @@ docker_setup_env() {
|
|||||||
|
|
||||||
# append md5 or trust auth to pg_hba.conf based on existence of POSTGRES_PASSWORD
|
# append md5 or trust auth to pg_hba.conf based on existence of POSTGRES_PASSWORD
|
||||||
pg_setup_hba_conf() {
|
pg_setup_hba_conf() {
|
||||||
local authMethod
|
local authMethod='md5'
|
||||||
if [ "$POSTGRES_PASSWORD" ]; then
|
if [ -z "$POSTGRES_PASSWORD" ]; then
|
||||||
authMethod='md5'
|
|
||||||
else
|
|
||||||
authMethod='trust'
|
authMethod='trust'
|
||||||
fi
|
fi
|
||||||
|
|
||||||
@ -232,7 +232,6 @@ _main() {
|
|||||||
set -- postgres "$@"
|
set -- postgres "$@"
|
||||||
fi
|
fi
|
||||||
|
|
||||||
|
|
||||||
if [ "$1" = 'postgres' ]; then
|
if [ "$1" = 'postgres' ]; then
|
||||||
docker_setup_env
|
docker_setup_env
|
||||||
# setup data directories and permissions (when run as root)
|
# setup data directories and permissions (when run as root)
|
||||||
|
@ -34,7 +34,7 @@ _is_sourced() {
|
|||||||
|
|
||||||
# used to create initial posgres directories and if run as root, ensure ownership to the "postgres" user
|
# used to create initial posgres directories and if run as root, ensure ownership to the "postgres" user
|
||||||
docker_create_db_directories() {
|
docker_create_db_directories() {
|
||||||
local user="$(id -u)"
|
local user; user="$(id -u)"
|
||||||
|
|
||||||
mkdir -p "$PGDATA"
|
mkdir -p "$PGDATA"
|
||||||
chmod 700 "$PGDATA"
|
chmod 700 "$PGDATA"
|
||||||
@ -46,7 +46,9 @@ docker_create_db_directories() {
|
|||||||
# Create the transaction log directory before initdb is run so the directory is owned by the correct user
|
# Create the transaction log directory before initdb is run so the directory is owned by the correct user
|
||||||
if [ "$POSTGRES_INITDB_WALDIR" ]; then
|
if [ "$POSTGRES_INITDB_WALDIR" ]; then
|
||||||
mkdir -p "$POSTGRES_INITDB_WALDIR"
|
mkdir -p "$POSTGRES_INITDB_WALDIR"
|
||||||
[ "$user" = '0' ] && find "$POSTGRES_INITDB_WALDIR" \! -user postgres - exec chown postgres '{}' +
|
if [ "$user" = '0' ]; then
|
||||||
|
find "$POSTGRES_INITDB_WALDIR" \! -user postgres -exec chown postgres '{}' +
|
||||||
|
fi
|
||||||
chmod 700 "$POSTGRES_INITDB_WALDIR"
|
chmod 700 "$POSTGRES_INITDB_WALDIR"
|
||||||
fi
|
fi
|
||||||
|
|
||||||
@ -193,10 +195,8 @@ docker_setup_env() {
|
|||||||
|
|
||||||
# append md5 or trust auth to pg_hba.conf based on existence of POSTGRES_PASSWORD
|
# append md5 or trust auth to pg_hba.conf based on existence of POSTGRES_PASSWORD
|
||||||
pg_setup_hba_conf() {
|
pg_setup_hba_conf() {
|
||||||
local authMethod
|
local authMethod='md5'
|
||||||
if [ "$POSTGRES_PASSWORD" ]; then
|
if [ -z "$POSTGRES_PASSWORD" ]; then
|
||||||
authMethod='md5'
|
|
||||||
else
|
|
||||||
authMethod='trust'
|
authMethod='trust'
|
||||||
fi
|
fi
|
||||||
|
|
||||||
@ -232,7 +232,6 @@ _main() {
|
|||||||
set -- postgres "$@"
|
set -- postgres "$@"
|
||||||
fi
|
fi
|
||||||
|
|
||||||
|
|
||||||
if [ "$1" = 'postgres' ]; then
|
if [ "$1" = 'postgres' ]; then
|
||||||
docker_setup_env
|
docker_setup_env
|
||||||
# setup data directories and permissions (when run as root)
|
# setup data directories and permissions (when run as root)
|
||||||
|
@ -34,7 +34,7 @@ _is_sourced() {
|
|||||||
|
|
||||||
# used to create initial posgres directories and if run as root, ensure ownership to the "postgres" user
|
# used to create initial posgres directories and if run as root, ensure ownership to the "postgres" user
|
||||||
docker_create_db_directories() {
|
docker_create_db_directories() {
|
||||||
local user="$(id -u)"
|
local user; user="$(id -u)"
|
||||||
|
|
||||||
mkdir -p "$PGDATA"
|
mkdir -p "$PGDATA"
|
||||||
chmod 700 "$PGDATA"
|
chmod 700 "$PGDATA"
|
||||||
@ -46,7 +46,9 @@ docker_create_db_directories() {
|
|||||||
# Create the transaction log directory before initdb is run so the directory is owned by the correct user
|
# Create the transaction log directory before initdb is run so the directory is owned by the correct user
|
||||||
if [ "$POSTGRES_INITDB_XLOGDIR" ]; then
|
if [ "$POSTGRES_INITDB_XLOGDIR" ]; then
|
||||||
mkdir -p "$POSTGRES_INITDB_XLOGDIR"
|
mkdir -p "$POSTGRES_INITDB_XLOGDIR"
|
||||||
[ "$user" = '0' ] && find "$POSTGRES_INITDB_XLOGDIR" \! -user postgres - exec chown postgres '{}' +
|
if [ "$user" = '0' ]; then
|
||||||
|
find "$POSTGRES_INITDB_XLOGDIR" \! -user postgres -exec chown postgres '{}' +
|
||||||
|
fi
|
||||||
chmod 700 "$POSTGRES_INITDB_XLOGDIR"
|
chmod 700 "$POSTGRES_INITDB_XLOGDIR"
|
||||||
fi
|
fi
|
||||||
|
|
||||||
@ -193,10 +195,8 @@ docker_setup_env() {
|
|||||||
|
|
||||||
# append md5 or trust auth to pg_hba.conf based on existence of POSTGRES_PASSWORD
|
# append md5 or trust auth to pg_hba.conf based on existence of POSTGRES_PASSWORD
|
||||||
pg_setup_hba_conf() {
|
pg_setup_hba_conf() {
|
||||||
local authMethod
|
local authMethod='md5'
|
||||||
if [ "$POSTGRES_PASSWORD" ]; then
|
if [ -z "$POSTGRES_PASSWORD" ]; then
|
||||||
authMethod='md5'
|
|
||||||
else
|
|
||||||
authMethod='trust'
|
authMethod='trust'
|
||||||
fi
|
fi
|
||||||
|
|
||||||
@ -232,7 +232,6 @@ _main() {
|
|||||||
set -- postgres "$@"
|
set -- postgres "$@"
|
||||||
fi
|
fi
|
||||||
|
|
||||||
|
|
||||||
if [ "$1" = 'postgres' ]; then
|
if [ "$1" = 'postgres' ]; then
|
||||||
docker_setup_env
|
docker_setup_env
|
||||||
# setup data directories and permissions (when run as root)
|
# setup data directories and permissions (when run as root)
|
||||||
|
@ -34,7 +34,7 @@ _is_sourced() {
|
|||||||
|
|
||||||
# used to create initial posgres directories and if run as root, ensure ownership to the "postgres" user
|
# used to create initial posgres directories and if run as root, ensure ownership to the "postgres" user
|
||||||
docker_create_db_directories() {
|
docker_create_db_directories() {
|
||||||
local user="$(id -u)"
|
local user; user="$(id -u)"
|
||||||
|
|
||||||
mkdir -p "$PGDATA"
|
mkdir -p "$PGDATA"
|
||||||
chmod 700 "$PGDATA"
|
chmod 700 "$PGDATA"
|
||||||
@ -46,7 +46,9 @@ docker_create_db_directories() {
|
|||||||
# Create the transaction log directory before initdb is run so the directory is owned by the correct user
|
# Create the transaction log directory before initdb is run so the directory is owned by the correct user
|
||||||
if [ "$POSTGRES_INITDB_XLOGDIR" ]; then
|
if [ "$POSTGRES_INITDB_XLOGDIR" ]; then
|
||||||
mkdir -p "$POSTGRES_INITDB_XLOGDIR"
|
mkdir -p "$POSTGRES_INITDB_XLOGDIR"
|
||||||
[ "$user" = '0' ] && find "$POSTGRES_INITDB_XLOGDIR" \! -user postgres - exec chown postgres '{}' +
|
if [ "$user" = '0' ]; then
|
||||||
|
find "$POSTGRES_INITDB_XLOGDIR" \! -user postgres -exec chown postgres '{}' +
|
||||||
|
fi
|
||||||
chmod 700 "$POSTGRES_INITDB_XLOGDIR"
|
chmod 700 "$POSTGRES_INITDB_XLOGDIR"
|
||||||
fi
|
fi
|
||||||
|
|
||||||
@ -193,10 +195,8 @@ docker_setup_env() {
|
|||||||
|
|
||||||
# append md5 or trust auth to pg_hba.conf based on existence of POSTGRES_PASSWORD
|
# append md5 or trust auth to pg_hba.conf based on existence of POSTGRES_PASSWORD
|
||||||
pg_setup_hba_conf() {
|
pg_setup_hba_conf() {
|
||||||
local authMethod
|
local authMethod='md5'
|
||||||
if [ "$POSTGRES_PASSWORD" ]; then
|
if [ -z "$POSTGRES_PASSWORD" ]; then
|
||||||
authMethod='md5'
|
|
||||||
else
|
|
||||||
authMethod='trust'
|
authMethod='trust'
|
||||||
fi
|
fi
|
||||||
|
|
||||||
@ -232,7 +232,6 @@ _main() {
|
|||||||
set -- postgres "$@"
|
set -- postgres "$@"
|
||||||
fi
|
fi
|
||||||
|
|
||||||
|
|
||||||
if [ "$1" = 'postgres' ]; then
|
if [ "$1" = 'postgres' ]; then
|
||||||
docker_setup_env
|
docker_setup_env
|
||||||
# setup data directories and permissions (when run as root)
|
# setup data directories and permissions (when run as root)
|
||||||
|
@ -34,7 +34,7 @@ _is_sourced() {
|
|||||||
|
|
||||||
# used to create initial posgres directories and if run as root, ensure ownership to the "postgres" user
|
# used to create initial posgres directories and if run as root, ensure ownership to the "postgres" user
|
||||||
docker_create_db_directories() {
|
docker_create_db_directories() {
|
||||||
local user="$(id -u)"
|
local user; user="$(id -u)"
|
||||||
|
|
||||||
mkdir -p "$PGDATA"
|
mkdir -p "$PGDATA"
|
||||||
chmod 700 "$PGDATA"
|
chmod 700 "$PGDATA"
|
||||||
@ -46,7 +46,9 @@ docker_create_db_directories() {
|
|||||||
# Create the transaction log directory before initdb is run so the directory is owned by the correct user
|
# Create the transaction log directory before initdb is run so the directory is owned by the correct user
|
||||||
if [ "$POSTGRES_INITDB_XLOGDIR" ]; then
|
if [ "$POSTGRES_INITDB_XLOGDIR" ]; then
|
||||||
mkdir -p "$POSTGRES_INITDB_XLOGDIR"
|
mkdir -p "$POSTGRES_INITDB_XLOGDIR"
|
||||||
[ "$user" = '0' ] && find "$POSTGRES_INITDB_XLOGDIR" \! -user postgres - exec chown postgres '{}' +
|
if [ "$user" = '0' ]; then
|
||||||
|
find "$POSTGRES_INITDB_XLOGDIR" \! -user postgres -exec chown postgres '{}' +
|
||||||
|
fi
|
||||||
chmod 700 "$POSTGRES_INITDB_XLOGDIR"
|
chmod 700 "$POSTGRES_INITDB_XLOGDIR"
|
||||||
fi
|
fi
|
||||||
|
|
||||||
@ -193,10 +195,8 @@ docker_setup_env() {
|
|||||||
|
|
||||||
# append md5 or trust auth to pg_hba.conf based on existence of POSTGRES_PASSWORD
|
# append md5 or trust auth to pg_hba.conf based on existence of POSTGRES_PASSWORD
|
||||||
pg_setup_hba_conf() {
|
pg_setup_hba_conf() {
|
||||||
local authMethod
|
local authMethod='md5'
|
||||||
if [ "$POSTGRES_PASSWORD" ]; then
|
if [ -z "$POSTGRES_PASSWORD" ]; then
|
||||||
authMethod='md5'
|
|
||||||
else
|
|
||||||
authMethod='trust'
|
authMethod='trust'
|
||||||
fi
|
fi
|
||||||
|
|
||||||
@ -232,7 +232,6 @@ _main() {
|
|||||||
set -- postgres "$@"
|
set -- postgres "$@"
|
||||||
fi
|
fi
|
||||||
|
|
||||||
|
|
||||||
if [ "$1" = 'postgres' ]; then
|
if [ "$1" = 'postgres' ]; then
|
||||||
docker_setup_env
|
docker_setup_env
|
||||||
# setup data directories and permissions (when run as root)
|
# setup data directories and permissions (when run as root)
|
||||||
|
@ -34,7 +34,7 @@ _is_sourced() {
|
|||||||
|
|
||||||
# used to create initial posgres directories and if run as root, ensure ownership to the "postgres" user
|
# used to create initial posgres directories and if run as root, ensure ownership to the "postgres" user
|
||||||
docker_create_db_directories() {
|
docker_create_db_directories() {
|
||||||
local user="$(id -u)"
|
local user; user="$(id -u)"
|
||||||
|
|
||||||
mkdir -p "$PGDATA"
|
mkdir -p "$PGDATA"
|
||||||
chmod 700 "$PGDATA"
|
chmod 700 "$PGDATA"
|
||||||
@ -46,7 +46,9 @@ docker_create_db_directories() {
|
|||||||
# Create the transaction log directory before initdb is run so the directory is owned by the correct user
|
# Create the transaction log directory before initdb is run so the directory is owned by the correct user
|
||||||
if [ "$POSTGRES_INITDB_XLOGDIR" ]; then
|
if [ "$POSTGRES_INITDB_XLOGDIR" ]; then
|
||||||
mkdir -p "$POSTGRES_INITDB_XLOGDIR"
|
mkdir -p "$POSTGRES_INITDB_XLOGDIR"
|
||||||
[ "$user" = '0' ] && find "$POSTGRES_INITDB_XLOGDIR" \! -user postgres - exec chown postgres '{}' +
|
if [ "$user" = '0' ]; then
|
||||||
|
find "$POSTGRES_INITDB_XLOGDIR" \! -user postgres -exec chown postgres '{}' +
|
||||||
|
fi
|
||||||
chmod 700 "$POSTGRES_INITDB_XLOGDIR"
|
chmod 700 "$POSTGRES_INITDB_XLOGDIR"
|
||||||
fi
|
fi
|
||||||
|
|
||||||
@ -193,10 +195,8 @@ docker_setup_env() {
|
|||||||
|
|
||||||
# append md5 or trust auth to pg_hba.conf based on existence of POSTGRES_PASSWORD
|
# append md5 or trust auth to pg_hba.conf based on existence of POSTGRES_PASSWORD
|
||||||
pg_setup_hba_conf() {
|
pg_setup_hba_conf() {
|
||||||
local authMethod
|
local authMethod='md5'
|
||||||
if [ "$POSTGRES_PASSWORD" ]; then
|
if [ -z "$POSTGRES_PASSWORD" ]; then
|
||||||
authMethod='md5'
|
|
||||||
else
|
|
||||||
authMethod='trust'
|
authMethod='trust'
|
||||||
fi
|
fi
|
||||||
|
|
||||||
@ -232,7 +232,6 @@ _main() {
|
|||||||
set -- postgres "$@"
|
set -- postgres "$@"
|
||||||
fi
|
fi
|
||||||
|
|
||||||
|
|
||||||
if [ "$1" = 'postgres' ]; then
|
if [ "$1" = 'postgres' ]; then
|
||||||
docker_setup_env
|
docker_setup_env
|
||||||
# setup data directories and permissions (when run as root)
|
# setup data directories and permissions (when run as root)
|
||||||
|
@ -34,7 +34,7 @@ _is_sourced() {
|
|||||||
|
|
||||||
# used to create initial posgres directories and if run as root, ensure ownership to the "postgres" user
|
# used to create initial posgres directories and if run as root, ensure ownership to the "postgres" user
|
||||||
docker_create_db_directories() {
|
docker_create_db_directories() {
|
||||||
local user="$(id -u)"
|
local user; user="$(id -u)"
|
||||||
|
|
||||||
mkdir -p "$PGDATA"
|
mkdir -p "$PGDATA"
|
||||||
chmod 700 "$PGDATA"
|
chmod 700 "$PGDATA"
|
||||||
@ -46,7 +46,9 @@ docker_create_db_directories() {
|
|||||||
# Create the transaction log directory before initdb is run so the directory is owned by the correct user
|
# Create the transaction log directory before initdb is run so the directory is owned by the correct user
|
||||||
if [ "$POSTGRES_INITDB_XLOGDIR" ]; then
|
if [ "$POSTGRES_INITDB_XLOGDIR" ]; then
|
||||||
mkdir -p "$POSTGRES_INITDB_XLOGDIR"
|
mkdir -p "$POSTGRES_INITDB_XLOGDIR"
|
||||||
[ "$user" = '0' ] && find "$POSTGRES_INITDB_XLOGDIR" \! -user postgres - exec chown postgres '{}' +
|
if [ "$user" = '0' ]; then
|
||||||
|
find "$POSTGRES_INITDB_XLOGDIR" \! -user postgres -exec chown postgres '{}' +
|
||||||
|
fi
|
||||||
chmod 700 "$POSTGRES_INITDB_XLOGDIR"
|
chmod 700 "$POSTGRES_INITDB_XLOGDIR"
|
||||||
fi
|
fi
|
||||||
|
|
||||||
@ -193,10 +195,8 @@ docker_setup_env() {
|
|||||||
|
|
||||||
# append md5 or trust auth to pg_hba.conf based on existence of POSTGRES_PASSWORD
|
# append md5 or trust auth to pg_hba.conf based on existence of POSTGRES_PASSWORD
|
||||||
pg_setup_hba_conf() {
|
pg_setup_hba_conf() {
|
||||||
local authMethod
|
local authMethod='md5'
|
||||||
if [ "$POSTGRES_PASSWORD" ]; then
|
if [ -z "$POSTGRES_PASSWORD" ]; then
|
||||||
authMethod='md5'
|
|
||||||
else
|
|
||||||
authMethod='trust'
|
authMethod='trust'
|
||||||
fi
|
fi
|
||||||
|
|
||||||
@ -232,7 +232,6 @@ _main() {
|
|||||||
set -- postgres "$@"
|
set -- postgres "$@"
|
||||||
fi
|
fi
|
||||||
|
|
||||||
|
|
||||||
if [ "$1" = 'postgres' ]; then
|
if [ "$1" = 'postgres' ]; then
|
||||||
docker_setup_env
|
docker_setup_env
|
||||||
# setup data directories and permissions (when run as root)
|
# setup data directories and permissions (when run as root)
|
||||||
|
@ -34,7 +34,7 @@ _is_sourced() {
|
|||||||
|
|
||||||
# used to create initial posgres directories and if run as root, ensure ownership to the "postgres" user
|
# used to create initial posgres directories and if run as root, ensure ownership to the "postgres" user
|
||||||
docker_create_db_directories() {
|
docker_create_db_directories() {
|
||||||
local user="$(id -u)"
|
local user; user="$(id -u)"
|
||||||
|
|
||||||
mkdir -p "$PGDATA"
|
mkdir -p "$PGDATA"
|
||||||
chmod 700 "$PGDATA"
|
chmod 700 "$PGDATA"
|
||||||
@ -46,7 +46,9 @@ docker_create_db_directories() {
|
|||||||
# Create the transaction log directory before initdb is run so the directory is owned by the correct user
|
# Create the transaction log directory before initdb is run so the directory is owned by the correct user
|
||||||
if [ "$POSTGRES_INITDB_XLOGDIR" ]; then
|
if [ "$POSTGRES_INITDB_XLOGDIR" ]; then
|
||||||
mkdir -p "$POSTGRES_INITDB_XLOGDIR"
|
mkdir -p "$POSTGRES_INITDB_XLOGDIR"
|
||||||
[ "$user" = '0' ] && find "$POSTGRES_INITDB_XLOGDIR" \! -user postgres - exec chown postgres '{}' +
|
if [ "$user" = '0' ]; then
|
||||||
|
find "$POSTGRES_INITDB_XLOGDIR" \! -user postgres -exec chown postgres '{}' +
|
||||||
|
fi
|
||||||
chmod 700 "$POSTGRES_INITDB_XLOGDIR"
|
chmod 700 "$POSTGRES_INITDB_XLOGDIR"
|
||||||
fi
|
fi
|
||||||
|
|
||||||
@ -193,10 +195,8 @@ docker_setup_env() {
|
|||||||
|
|
||||||
# append md5 or trust auth to pg_hba.conf based on existence of POSTGRES_PASSWORD
|
# append md5 or trust auth to pg_hba.conf based on existence of POSTGRES_PASSWORD
|
||||||
pg_setup_hba_conf() {
|
pg_setup_hba_conf() {
|
||||||
local authMethod
|
local authMethod='md5'
|
||||||
if [ "$POSTGRES_PASSWORD" ]; then
|
if [ -z "$POSTGRES_PASSWORD" ]; then
|
||||||
authMethod='md5'
|
|
||||||
else
|
|
||||||
authMethod='trust'
|
authMethod='trust'
|
||||||
fi
|
fi
|
||||||
|
|
||||||
@ -232,7 +232,6 @@ _main() {
|
|||||||
set -- postgres "$@"
|
set -- postgres "$@"
|
||||||
fi
|
fi
|
||||||
|
|
||||||
|
|
||||||
if [ "$1" = 'postgres' ]; then
|
if [ "$1" = 'postgres' ]; then
|
||||||
docker_setup_env
|
docker_setup_env
|
||||||
# setup data directories and permissions (when run as root)
|
# setup data directories and permissions (when run as root)
|
||||||
|
@ -34,7 +34,7 @@ _is_sourced() {
|
|||||||
|
|
||||||
# used to create initial posgres directories and if run as root, ensure ownership to the "postgres" user
|
# used to create initial posgres directories and if run as root, ensure ownership to the "postgres" user
|
||||||
docker_create_db_directories() {
|
docker_create_db_directories() {
|
||||||
local user="$(id -u)"
|
local user; user="$(id -u)"
|
||||||
|
|
||||||
mkdir -p "$PGDATA"
|
mkdir -p "$PGDATA"
|
||||||
chmod 700 "$PGDATA"
|
chmod 700 "$PGDATA"
|
||||||
@ -46,7 +46,9 @@ docker_create_db_directories() {
|
|||||||
# Create the transaction log directory before initdb is run so the directory is owned by the correct user
|
# Create the transaction log directory before initdb is run so the directory is owned by the correct user
|
||||||
if [ "$POSTGRES_INITDB_WALDIR" ]; then
|
if [ "$POSTGRES_INITDB_WALDIR" ]; then
|
||||||
mkdir -p "$POSTGRES_INITDB_WALDIR"
|
mkdir -p "$POSTGRES_INITDB_WALDIR"
|
||||||
[ "$user" = '0' ] && find "$POSTGRES_INITDB_WALDIR" \! -user postgres - exec chown postgres '{}' +
|
if [ "$user" = '0' ]; then
|
||||||
|
find "$POSTGRES_INITDB_WALDIR" \! -user postgres -exec chown postgres '{}' +
|
||||||
|
fi
|
||||||
chmod 700 "$POSTGRES_INITDB_WALDIR"
|
chmod 700 "$POSTGRES_INITDB_WALDIR"
|
||||||
fi
|
fi
|
||||||
|
|
||||||
@ -193,10 +195,8 @@ docker_setup_env() {
|
|||||||
|
|
||||||
# append md5 or trust auth to pg_hba.conf based on existence of POSTGRES_PASSWORD
|
# append md5 or trust auth to pg_hba.conf based on existence of POSTGRES_PASSWORD
|
||||||
pg_setup_hba_conf() {
|
pg_setup_hba_conf() {
|
||||||
local authMethod
|
local authMethod='md5'
|
||||||
if [ "$POSTGRES_PASSWORD" ]; then
|
if [ -z "$POSTGRES_PASSWORD" ]; then
|
||||||
authMethod='md5'
|
|
||||||
else
|
|
||||||
authMethod='trust'
|
authMethod='trust'
|
||||||
fi
|
fi
|
||||||
|
|
||||||
@ -232,7 +232,6 @@ _main() {
|
|||||||
set -- postgres "$@"
|
set -- postgres "$@"
|
||||||
fi
|
fi
|
||||||
|
|
||||||
|
|
||||||
if [ "$1" = 'postgres' ]; then
|
if [ "$1" = 'postgres' ]; then
|
||||||
docker_setup_env
|
docker_setup_env
|
||||||
# setup data directories and permissions (when run as root)
|
# setup data directories and permissions (when run as root)
|
||||||
|
Reference in New Issue
Block a user