LoginSignup
0
0

More than 1 year has passed since last update.

Firebase Realtime DatabaseとAuthenticationのデータをEmulator上に全部コピーする

Last updated at Posted at 2022-08-10

Databaseに認証ルールとかがある場合にはAuthenticationもEmulator上に存在しないとうまく動かない

# 保存先のディレクトリ構造を生成させる
$ npx firebase emulators:exec "exit 0" --export-on-exit /tmp/firebase-test-export --project your-own-app

# Databaseの内容をEmulatorでimportするディレクトリに書き出し
$ npx firebase database:get / --export --output /tmp/firebase-test-export/database_export/your-own-app.json  --project your-own-app

# Authenticationの内容をEmulatorでimportするディレクトリに書き出し
$ npx firebase auth:export /tmp/firebase-test-export/auth_export/accounts.json --project your-own-app

# 上記で書き出されたディレクトリをimportしてEmulatorを起動
$ npx firebase emulators:start --import /tmp/firebase-test-export/database_export --project your-own-app
0
0
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
0
0