54 lines
1.3 KiB
Bash
54 lines
1.3 KiB
Bash
export PATH="/usr/local/opt/libpq/bin:$PATH"
|
|
alias psql=/opt/homebrew/opt/libpq/bin/psql
|
|
export PATH="/opt/homebrew/bin:$PATH"
|
|
export ptdir="/Users/joesmith/dbre-build/prod-tools/bin"
|
|
|
|
export ght=token
|
|
|
|
|
|
function getrep(){
|
|
git clone "https:${ght}"@github.com/"${1}".git
|
|
}
|
|
|
|
function buildDb(){
|
|
export VAULT_ADDR=https://cci-prod-vault-a.infra.circleci.com
|
|
export VAULT_CACERT=/Users/joesmith/vault.pem
|
|
aws sso login --profile cci
|
|
vault login -method oidc
|
|
}
|
|
|
|
function V(){
|
|
export VAULT_ADDR=https://cci-prod-vault-a.infra.circleci.com
|
|
export VAULT_CACERT=/Users/joesmith/vault.pem
|
|
vault login -method oidc
|
|
}
|
|
|
|
function tempDb(){
|
|
unset $TMP_PG_NAME
|
|
unset $TMP_PG_PW
|
|
export TMP_PG_NAME=pg_$(openssl rand -hex 12 )
|
|
export TMP_PG_PW=postgres
|
|
docker run -p 5432 --name $TMP_PG_NAME -e POSTGRES_PASSWORD=postgres -d postgres
|
|
echo "TMP_PG_NAME=${TMP_PG_NAME}"
|
|
echo "local password: posgres"
|
|
echo "local user: postgres"
|
|
echo "waiting to let pg start up and entering temp database"
|
|
sleep 5
|
|
logT
|
|
}
|
|
|
|
function logT(){
|
|
export POSTGRES_PASSWORD=$TMP_PG_PW
|
|
psql -h localhost -U postgres postgres
|
|
}
|
|
|
|
function stopTemp(){
|
|
docker stop $TMP_PG_NAME
|
|
docker rm $TMP_PG_NAME
|
|
docker rmi -f $TMP_PG_NAME
|
|
docker system prune -f
|
|
}
|
|
|
|
function pt(){
|
|
"${ptdir}"/prod-tools
|
|
} |