-
Notifications
You must be signed in to change notification settings - Fork 3
/
.envrc
38 lines (32 loc) · 1.17 KB
/
.envrc
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
export GPG_TTY="$(tty)"
# this allows mix to work on the local directory
export MIX_HOME=$PWD/.nix-mix
export HEX_HOME=$PWD/.nix-mix
export PATH=$MIX_HOME/bin:$HEX_HOME/bin:$PATH
export ERL_AFLAGS="-kernel shell_history enabled"
export LANG=en_US.UTF-8
use flake
# Setup postgresql
if test -d "/Applications/Postgres.app"; then
export DATABASE_USER="$(whoami)"
export DATABASE_PASSWORD=""
else
# postges related
export DATABASE_USER="supabase_potion"
export DATABASE_PASSWORD="supabase_potion"
export PG_DATABASE="supabase_potion_dev"
# keep all your db data in a folder inside the project
export PGHOST="$PWD/.postgres"
export PGDATA="$PGHOST/data"
export PGLOG="$PGHOST/server.log"
if [[ ! -d "$PGDATA" ]]; then
# initital set up of database server
initdb --auth=trust --no-locale --encoding=UTF8 -U=$DATABASE_USER >/dev/null
# point to correct unix sockets
echo "unix_socket_directories = '$PGHOST'" >> "$PGDATA/postgresql.conf"
# creates loacl database user
echo "CREATE USER $DATABASE_USER SUPERUSER;" | postgres --single -E postgres
# creates local databse
echo "CREATE DATABASE $PG_DATABASE;" | postgres --single -E postgres
fi
fi