2022-01-31 20:50:16 +01:00
|
|
|
use flake
|
2022-03-01 10:04:34 +01:00
|
|
|
eval "$shellHook"
|
2023-07-12 23:16:32 +02:00
|
|
|
layout_postgres() {
|
|
|
|
export PGDATA="$(direnv_layout_dir)/postgres"
|
|
|
|
export PGHOST="$PGDATA"
|
|
|
|
if [[ ! -d "$PGDATA" ]]; then
|
|
|
|
initdb
|
2023-07-14 14:15:01 +02:00
|
|
|
echo -e "listen_addresses = 'localhost'\nunix_socket_directories = '$PGHOST'" >> "$PGDATA/postgresql.conf"
|
2023-07-14 14:34:56 +02:00
|
|
|
echo "CREATE DATABASE django;" | postgres --single -E postgres
|
2023-07-12 23:16:32 +02:00
|
|
|
fi
|
|
|
|
}
|
|
|
|
layout postgres
|
2023-07-13 23:02:56 +02:00
|
|
|
export PROJECT_DIR=$(pwd)
|
2023-07-22 15:58:26 +02:00
|
|
|
export WEBPORT=$(($RANDOM + 1100))
|
|
|
|
export PGPORT=$(($WEBPORT + 100))
|
2023-07-18 20:59:09 +02:00
|
|
|
watch_file "$PGDATA/postgresql.conf"
|
2023-07-22 15:59:00 +02:00
|
|
|
|