network_inventory/.envrc

18 lines
519 B
Plaintext
Raw Normal View History

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)
export WEBPORT=$(($RANDOM + 1100))
export PGPORT=$(($WEBPORT + 100))
watch_file "$PGDATA/postgresql.conf"