Created
November 7, 2018 16:35
-
-
Save jasonpincin/c3260b486314f59480cd3000d303f41b to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/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