Grab the credentials from the .env file.
This commit is contained in:
parent
feab19266e
commit
4b8dfd5d26
|
@ -1,5 +1,11 @@
|
|||
#!/bin/bash
|
||||
|
||||
# Take the current datetime:
|
||||
DT=`date +%Y-%m-%d`
|
||||
# Set the environment:
|
||||
set -o allexport
|
||||
source ../.env
|
||||
set +o allexport
|
||||
# Take the current datetime:
|
||||
DT=`date +%Y-%m-%d`
|
||||
# Create the backup:
|
||||
|
@ -7,4 +13,4 @@ docker exec cockroach \
|
|||
cockroach sql \
|
||||
--host cockroach:26257 \
|
||||
--certs-dir=/certs \
|
||||
--execute="BACKUP TO 's3://skynet-crdb-backups/backups/$DT?AWS_ACCESS_KEY_ID=$AWS_KEY_ID&AWS_SECRET_ACCESS_KEY=$AWS_SECRET_KET';"
|
||||
--execute="BACKUP TO 's3://skynet-crdb-backups/backups/$DT?AWS_ACCESS_KEY_ID=$AWS_ACCESS_KEY_ID&AWS_SECRET_ACCESS_KEY=$AWS_SECRET_ACCESS_KEY';"
|
||||
|
|
|
@ -6,8 +6,13 @@ if [[ $BACKUP == "" ]]; then
|
|||
exit 1
|
||||
fi
|
||||
|
||||
# Set the environment:
|
||||
set -o allexport
|
||||
source ../.env
|
||||
set +o allexport
|
||||
# Restore the backup:
|
||||
docker exec cockroach \
|
||||
cockroach sql \
|
||||
--host cockroach:26257 \
|
||||
--certs-dir=/certs \
|
||||
--execute="RESTORE DATABASE defaultdb FROM 's3://skynet-crdb-backups/backups/$DT?AWS_ACCESS_KEY_ID=$AWS_KEY_ID&AWS_SECRET_ACCESS_KEY=$AWS_SECRET_KET';"
|
||||
--execute="RESTORE DATABASE defaultdb FROM 's3://skynet-crdb-backups/backups/$DT?AWS_ACCESS_KEY_ID=$AWS_ACCESS_KEY_ID&AWS_SECRET_ACCESS_KEY=$AWS_SECRET_ACCESS_KEY';"
|
||||
|
|
Reference in New Issue