Google-cloud-php: [Firestore] add support for emulator

Created on 16 Feb 2019  路  6Comments  路  Source: googleapis/google-cloud-php

Google endpoint (gRPC) is hardcoded:

FirestoreGapicClient::SERVICE_ADDRESS = 'firestore.googleapis.com';
FirestoreGapicClient::DEFAULT_SERVICE_PORT = 443;

I can't find a way to enable emulator mode (localhost and specific port).

firestore feature request

Most helpful comment

Hi @smalot, @maximelebastard. Support for the Firestore emulator is included in google/cloud v0.94.0, and shortly will be available in google/cloud-firestore v1.1.0.

All 6 comments

@smalot, we should be able to add this :). @danielgsims would you mind taking a look, please?

I tried to override constants with localhost and 8080, but the connection is created using SSL which seems not to be used with the emulator.

according to the emulator, we should use FIRESTORE_EMULATOR_HOST env var.

https://storage.googleapis.com/firebase-preview-drop/emulator/cloud-firestore-emulator-v1.3.0.jar

firestore_1  | API endpoint: http://0.0.0.0:8080
firestore_1  | If you are using a library that supports the FIRESTORE_EMULATOR_HOST environment variable, run:
firestore_1  | 
firestore_1  |    export FIRESTORE_EMULATOR_HOST=0.0.0.0:8080
firestore_1  | 
firestore_1  | Dev App Server is now running.

Hi, we're moving from Google Datastore to Firestore and we used the DATASTORE_EMULATOR_HOST environment variable for local dev.

The same behavior with FIRESTORE_EMULATOR_HOST on this lib would be great as Datastore users are more and more pushed to Firestore

Hi @smalot, @maximelebastard. Support for the Firestore emulator is included in google/cloud v0.94.0, and shortly will be available in google/cloud-firestore v1.1.0.

It works like a charm !

Was this page helpful?
0 / 5 - 0 ratings

Related issues

codeflorist picture codeflorist  路  5Comments

joseph1125 picture joseph1125  路  8Comments

lorenzosfarra picture lorenzosfarra  路  7Comments

highstrike picture highstrike  路  5Comments

Google-K picture Google-K  路  6Comments