As a follow up to #1167 I am filing this FR for people who want to track the support for --import and emulators:export on the Realtime Database emulator.
Internally this is http://b/149591624
Much needed!
My local emulators are useless until this is complete because it uses config variables from the realtime database
+1 this would be awesome to have
@jQrgen you should be able to copy data into the RTDB emulator by using emulator environment variables along with firebase-tools database commands as described in this comment.
If you are looking to leave the emulators running instead of shutting down after (common use of emulators:exec) you can use concurrently along with wait-on to run your import command only after the emulator ports are open:
package.json:
"scripts": {
"rtdb:import": "wait-on tcp:9000 && cross-env FIREBASE_DATABASE_EMULATOR_HOST=localhost:9000 firebase database:update / ./rtdbdata.json -y && echo \"Imported RTDB\"",
"emu:start": "firebase emulators:start --only firestore,database",
"emulators": "concurrently -n seeding,emulators -c cyan,green npm:rtdb:import npm:emu:start",
},
"devDependencies": {
"cross-env": "7.0.2",
"concurrently": "5.1.0",
"wait-on": "4.0.0"
}
@prescottprue thanks for sharing! The main reason we need to add something more complex is that we want to enable loading data into the RTDB emulator without triggering any Cloud Functions.
This has been added in #2429 and will be available in the next release.
Version 8.5.0 of firebase-tools contains import/export support for RTDB! Try it out and let us know how it's going!
@samtstern It works!
Most helpful comment
This has been added in #2429 and will be available in the next release.