-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy path.envrc
More file actions
26 lines (20 loc) · 750 Bytes
/
.envrc
File metadata and controls
26 lines (20 loc) · 750 Bytes
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
dotenv
export ANDROID_HOME=~/Android/Sdk
export PATH=$PATH:$ANDROID_HOME/cmdline-tools/latest/bin:$ANDROID_HOME/platform-tools
# Parse DATABASE_URL to set psql environment variables
if [[ -n "$DATABASE_URL" ]]; then
# Remove protocol prefix (postgresql:// or postgres://)
url_without_protocol="${DATABASE_URL#*://}"
# Extract user:password@host:port/database
userinfo="${url_without_protocol%%@*}"
hostinfo="${url_without_protocol#*@}"
# Extract user and password
export PGUSER="${userinfo%%:*}"
export PGPASSWORD="${userinfo#*:}"
# Extract host:port and database
hostport="${hostinfo%%/*}"
export PGDATABASE="${hostinfo#*/}"
# Extract host and port
export PGHOST="${hostport%%:*}"
export PGPORT="${hostport#*:}"
fi