mirror of
https://github.com/NixOS/nixpkgs.git
synced 2025-07-14 14:10:33 +03:00
postgresql: properly fix permissions issue by in postStart
as per postgresql manual, interactions with psql should be carried out with the postgresql system user and postgresql db user by default. ensure it happens in postStart.
This commit is contained in:
parent
6167da54ea
commit
c66be6378d
1 changed files with 2 additions and 2 deletions
|
@ -225,14 +225,14 @@ in
|
|||
# Wait for PostgreSQL to be ready to accept connections.
|
||||
postStart =
|
||||
''
|
||||
while ! psql postgres -c "" 2> /dev/null; do
|
||||
while ! su -s ${pkgs.stdenv.shell} postgres -c 'psql postgres -c ""' 2> /dev/null; do
|
||||
if ! kill -0 "$MAINPID"; then exit 1; fi
|
||||
sleep 0.1
|
||||
done
|
||||
|
||||
if test -e "${cfg.dataDir}/.first_startup"; then
|
||||
${optionalString (cfg.initialScript != null) ''
|
||||
cat "${cfg.initialScript}" | psql postgres
|
||||
cat "${cfg.initialScript}" | su -s ${pkgs.stdenv.shell} postgres -c 'psql postgres'
|
||||
''}
|
||||
rm -f "${cfg.dataDir}/.first_startup"
|
||||
fi
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue