Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: Support listDocuments()/listCollections() via the Firestore Emulator #654

Merged

Conversation

ryanpbrewster
Copy link
Contributor

@ryanpbrewster ryanpbrewster commented May 23, 2019

These custom headers can be passed in via an customHeaders field in the constructor, and are plumbed all the way through to the gRPC metadata in CallOptions.

With this change it is much simpler to connect to the Firestore emulator:

const grpc = require("@grpc/grpc-js");
const Firestore = require("@google-cloud/firestore");
const firestore = new Firestore({
  projectId: 'firestore-emulator-sample',
  servicePath: 'localhost',
  port: 8080,
  sslCreds: grpc.credentials.createInsecure(),
  customHeaders: {
    "Authorization": "Bearer owner"
  }
});

I thought this was the right level of abstraction: not too general (only constant headers provided at instantiation time) but not too specific (allows arbitrary headers, rather than only the Authorization header, or some special purpose emulator field).

@googlebot googlebot added the cla: yes This human has signed the Contributor License Agreement. label May 23, 2019
Copy link
Contributor

@schmidt-sebastian schmidt-sebastian left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nice! LGTM.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
cla: yes This human has signed the Contributor License Agreement.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants