17 lines
518 B
Plaintext
17 lines
518 B
Plaintext
use flake
|
|
eval "$shellHook"
|
|
layout_postgres() {
|
|
export PGDATA="$(direnv_layout_dir)/postgres"
|
|
export PGHOST="$PGDATA"
|
|
if [[ ! -d "$PGDATA" ]]; then
|
|
initdb
|
|
echo -e "listen_addresses = 'localhost'\nunix_socket_directories = '$PGHOST'" >> "$PGDATA/postgresql.conf"
|
|
echo "CREATE DATABASE django;" | postgres --single -E postgres
|
|
fi
|
|
}
|
|
layout postgres
|
|
export PROJECT_DIR=$(pwd)
|
|
export WEBPORT=$(($RANDOM + 1100))
|
|
export PGPORT=$(($WEBPORT + 100))
|
|
watch_file "$PGDATA/postgresql.conf"
|