Skip to content

Commit

Permalink
don't expose b2 credentials in command line
Browse files Browse the repository at this point in the history
  • Loading branch information
mjurbanski-reef committed Nov 24, 2023
1 parent 644cf34 commit 64b2222
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 3 deletions.
4 changes: 3 additions & 1 deletion {{cookiecutter.repostory_name}}/bin/backup-file-to-b2.sh
Original file line number Diff line number Diff line change
Expand Up @@ -15,5 +15,7 @@ else
BACKUP_B2_FILENAME"$(basename "$1")"
fi

docker run --rm -iq -e B2_APPLICATION_KEY="$BACKUP_B2_KEY_SECRET" -e B2_APPLICATION_KEY_ID="$BACKUP_B2_KEY_ID" \
export B2_APPLICATION_KEY_ID="$BACKUP_B2_KEY_ID"
export B2_APPLICATION_KEY="$BACKUP_B2_KEY_SECRET"
docker run --rm -iq -e B2_APPLICATION_KEY -e B2_APPLICATION_KEY_ID \
backblazeit/b2:3.13.1 upload-file "$BACKUP_B2_BUCKET" "$1" "$BACKUP_B2_FILENAME"
4 changes: 3 additions & 1 deletion {{cookiecutter.repostory_name}}/bin/list-b2-backups.sh
Original file line number Diff line number Diff line change
Expand Up @@ -7,5 +7,7 @@ BACKUP_B2_KEY_ID="${1-$BACKUP_B2_KEY_ID}"
BACKUP_B2_KEY_SECRET="${2-$BACKUP_B2_KEY_SECRET}"
BACKUP_B2_BUCKET="${3-$BACKUP_B2_BUCKET}"

docker run --rm -iq -e B2_APPLICATION_KEY="$BACKUP_B2_KEY_SECRET" -e B2_APPLICATION_KEY_ID="$BACKUP_B2_KEY_ID" \
export B2_APPLICATION_KEY_ID="$BACKUP_B2_KEY_ID"
export B2_APPLICATION_KEY="$BACKUP_B2_KEY_SECRET"
docker run --rm -iq -e B2_APPLICATION_KEY -e B2_APPLICATION_KEY_ID \
backblazeit/b2:3.13.1 ls --long "$BACKUP_B2_BUCKET"
4 changes: 3 additions & 1 deletion {{cookiecutter.repostory_name}}/bin/restore-db-from-b2.sh
Original file line number Diff line number Diff line change
Expand Up @@ -11,5 +11,7 @@ fi

B2_FILE_ID="$1"

docker run --rm -iq -e B2_APPLICATION_KEY="$BACKUP_B2_KEY_SECRET" -e B2_APPLICATION_KEY_ID="$BACKUP_B2_KEY_ID" \
export B2_APPLICATION_KEY_ID="$BACKUP_B2_KEY_ID"
export B2_APPLICATION_KEY="$BACKUP_B2_KEY_SECRET"
docker run --rm -iq -e B2_APPLICATION_KEY -e B2_APPLICATION_KEY_ID \
backblazeit/b2:3.13.1 cat "b2id://$B2_FILE_ID" | "${SCRIPT_DIR}"/restore-db.sh -

0 comments on commit 64b2222

Please sign in to comment.