home: create 'modules/home' folder
Consolidating all modules under the same path, to clear out the top-level directory.
This commit is contained in:
parent
c856933803
commit
65a8f7c481
119 changed files with 2 additions and 2 deletions
22
modules/home/direnv/lib/postgres.sh
Normal file
22
modules/home/direnv/lib/postgres.sh
Normal file
|
|
@ -0,0 +1,22 @@
|
|||
#shellcheck shell=bash
|
||||
|
||||
layout_postgres() {
|
||||
if ! has postgres || ! has initdb; then
|
||||
# shellcheck disable=2016
|
||||
log_error 'layout_postgres: `postgres` and `initdb` are not in PATH'
|
||||
return 1
|
||||
fi
|
||||
|
||||
# shellcheck disable=2155
|
||||
export PGDATA="$(direnv_layout_dir)/postgres"
|
||||
export PGHOST="$PGDATA"
|
||||
|
||||
if [[ ! -d "$PGDATA" ]]; then
|
||||
initdb
|
||||
cat >> "$PGDATA/postgresql.conf" << EOF
|
||||
listen_addresses = ''
|
||||
unix_socket_directories = '$PGHOST'
|
||||
EOF
|
||||
echo "CREATE DATABASE $USER;" | postgres --single -E postgres
|
||||
fi
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue