- firebaseプロジェクトの初期化は終えておく
firebase init emulators
- Emulator Suite を設定する
- 目的のエミュレータを選択し、対応するエミュレータのバイナリ ファイルをダウンロードして、デフォルトが適切でない場合はエミュレータ ポートを設定します。
- エミュレータがインストールされると、Firebase CLI のバージョンを更新するまで、アップデートのチェックは行われず、追加の自動ダウンロードも行われない
- 必要に応じて、エミュレータのネットワークポートとセキュリティルール定義へのパスをfirebase.jsonファイルで構成できる
firebase init emulators
を実行するfirebase.json
を手動で編集して、エミュレータのポートを変更、セキュリティ ルールの定義へのパスを変更する
- 各エミュレータは、希望するデフォルト値でマシン上の異なるポートにバインドされる
エミュレータ | デフォルト ポート |
---|---|
Authentication | 9099 |
Emulator Suite UI | 4000 |
Cloud Functions | 5001 |
Realtime Database | 9000 |
Cloud Firestore | 8080 |
Cloud Storage | 9199 |
Firebase Hosting | 5000 |
Pub/Sub | 8085 |
- エミュレータ ハブの /emulators エンドポイントに GET リクエストを送信する
curl localhost:4400/emulators
- 実行中のすべてのエミュレータと、そのホストおよびポートの構成などのリストが含まれるJSONオブジェクトが返される
functions
ディレクトリ内で.runtimeconfig.json
に書き出すfirebase functions:config:get > .runtimeconfig.json
- プロジェクト初期化時に
.gitignore
として.runtimeconfig.json
が入っている
- Local Emulator Suite を設定する | Firebase Documentation
- Local Emulator Suite のインストール、構成、統合 | Firebase Documentation
- アプリを Cloud Firestore エミュレータに接続する | Firebase Documentation
- Firebase Local Emulator Suite の概要 | Firebase Documentation
- Local Emulator Suite を設定する | Firebase Documentation
- ローカルでの関数の実行 | Firebase