Skip to content

Instantly share code, notes, and snippets.

@jasonpincin
Created November 7, 2018 16:35
Show Gist options
  • Save jasonpincin/c3260b486314f59480cd3000d303f41b to your computer and use it in GitHub Desktop.
Save jasonpincin/c3260b486314f59480cd3000d303f41b to your computer and use it in GitHub Desktop.
#!/usr/bin/env bash
VDATA=$(vault read -format=json secret/core/core-id/staging/us-east-1/rds)
PW=$(echo $VDATA | jq -r .data.password)
USER=$(echo $VDATA | jq -r .data.username)
DBNAME=$(echo $VDATA | jq -r .data.dbname)
HOST=$(echo $VDATA | jq -r .data.endpoint)
tables="Users,AccessToken,AuthorizationCode,Client,ClientCredentials,IdStore,InitialAccessToken,RefreshToken,RegistrationAccessToken,Session"
PGPASSWORD=$PW psql \
-h $HOST \
-p 5432 \
-U $USER \
-d $DBNAME \
-c "TRUNCATE TABLE $tables"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment