Created
March 18, 2020 13:47
-
-
Save yutakahashi114/275bf9890fd79bfe7afd7f7ee2d305ef 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
#!/bin/bash | |
export_path="/firestore/firestore_export/firestore_export.overall_export_metadata" | |
start_command="/google-cloud-sdk/platform/cloud-firestore-emulator/cloud_firestore_emulator start --host=0.0.0.0 --port=8812" | |
if [ -e $export_path ]; then | |
$start_command --seed_from_export=$export_path & | |
else | |
$start_command & | |
fi | |
while true | |
do | |
curl -XPOST -H "Content-Type: application/json" -d "{\"database\": \"projects/$PROJECT_ID/databases/(default)\", \"export_directory\": \"/firestore\", \"export_name\": \"firestore_export\"}" http://0.0.0.0:8812/emulator/v1/projects/$PROJECT_ID:export | |
sleep 5 | |
done |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment