Skip to content

Commit eb454f1

Browse files
feat: find emulator project id from environment variable
Previously, if `FIRESTORE_EMULATOR_HOST` was set and a `Client` instance was created without an explicit project, it would fall-back to `google-cloud-firestore-emulator` This change makes it check the `GCLOUD_PROJECT` variable for a project id first, which is used by the firebase functions emulator. This means the client will auto-detect the project id if not given in the emulator, just like in a live GCP environment Fixes firebase/firebase-functions-python#174
1 parent 6cb3147 commit eb454f1

File tree

1 file changed

+2
-1
lines changed

1 file changed

+2
-1
lines changed

Diff for: google/cloud/firestore_v1/base_client.py

+2-1
Original file line numberDiff line numberDiff line change
@@ -131,7 +131,8 @@ def __init__(
131131
if credentials is None:
132132
credentials = AnonymousCredentials()
133133
if project is None:
134-
project = _DEFAULT_EMULATOR_PROJECT
134+
# extract project from env var, or use system default
135+
project = os.getenv("GCLOUD_PROJECT", _DEFAULT_EMULATOR_PROJECT)
135136

136137
super(BaseClient, self).__init__(
137138
project=project,

0 commit comments

Comments
 (0)