Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- bash-3.2$ DATABASE_URL='postgres://username:password@hostname.net:port/dbname'
- bash-3.2$ [[ $DATABASE_URL =~ (.*)'://'(.*):(.*)@(.*):(.*)/(.*) ]] && \
- DB_USERNAME=${BASH_REMATCH[2]} \
- DB_PASSWORD=${BASH_REMATCH[3]} \
- DB_HOST=${BASH_REMATCH[4]} \
- DB_PORT=${BASH_REMATCH[5]} \
- DB_DBNAME=${BASH_REMATCH[6]} env |grep DB_
- DB_PORT=port
- DB_USERNAME=username
- DB_DBNAME=dbname
- DB_PASSWORD=password
- DB_HOST=hostname.net
Add Comment
Please, Sign In to add comment