-
Notifications
You must be signed in to change notification settings - Fork 8
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
adding firestore emulator client #4
Conversation
(.setProjectId project-id) | ||
(.setChannelProvider channel-provider) | ||
^FirestoreOptions$Builder | ||
(.setCredentials credentials) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
As far as I can tell the fake credentials are not used, except to guarantee validation works for the builder.
The real authorization happens using the fixed-header-provider
https://github.com/polvotech/firestore-clj/pull/4/files#diff-8dcfb082370a13ada9fe204cec4f7a1aR27
] | ||
:profiles {:dev {:dependencies [[com.taoensso/timbre "4.10.0"] | ||
[com.fzakaria/slf4j-timbre "0.3.19"] | ||
[com.google.cloud/google-cloud-logging-logback "0.116.0-alpha"]] |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Used to pick up grpc
logs in order to debug why auth was failing.
(comment | ||
(require '[taoensso.timbre :as log]) | ||
(require '[firestore-clj.core :as f]) | ||
(def my-db (emulator-client "test-app-4" "localhost:8080")) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Example usage:
bash$ firebase emulators:start --only firestore
⚠ Could not find config (firebase.json) so using defaults.
i emulators: Starting emulators: firestore
⚠ firestore: Did not find a Cloud Firestore rules file specified in a firebase.json config file.
⚠ firestore: The emulator will default to allowing all reads and writes. Learn more about this option: https://firebase.google.com/docs/emulator-suite/install_and_configure#security_rules_configuration.
i firestore: firestore emulator logging to firestore-debug.log
✔ firestore: firestore emulator started at http://localhost:8080
i firestore: For testing set FIRESTORE_EMULATOR_HOST=localhost:8080
✔ emulators: All emulators started, it is now safe to connect.
(emulator-client "test-app-4" "localhost:8080")
=> Firestore instance.
Collections: ["accounts"]
Thank for you for the great contribution! I'm quite busy for now and tomorrow, but I'll surely review and hopefully merge by the weekend! |
Merged! Didn't make any significant editing, just moved If you could also add comments describing in more detail what is happening, since it seems we're being hacky here, it would be great for future maintenance. Thank you again! |
I also took the liberty of adding you to the contributors section of the README, but can delete that if it's your wish. |
Sure thing. And yes it is being hacky. Although it is not explicitly stated in the java source code. It looks like the client is being "defensive" and only wants to allow you to configure the emulator client if you set the environment variable |
This works but the code isn't cleaned up.
Looking for an initial review