-
Notifications
You must be signed in to change notification settings - Fork 349
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
How to force datastore to use the local development server? #14091
Comments
nit: nowadays I would write: namespace g = google::cloud;
client_ = g::storage::Client(g::Options{}
.set<g::storage::RestEndpointOption>("http://localhost:9199")
.set<g::CredentialsOption>(g::MakeInsecureCredentials()));
This should be possible. The documentation is in: https://cloud.google.com/cpp/docs/reference/datastore/latest/datastore-override-endpoint and https://cloud.google.com/cpp/docs/reference/datastore/latest/datastore-override-authentication Both use the Admin client as examples, but reference the examples for the https://cloud.google.com/cpp/docs/reference/datastore/latest/datastore_v1_1_1DatastoreClient-service-account-snippet In summary, I think you want something like this (modulo the endpoint, I am not sure what endpoint is the correct one for auto client = g::datastore_v1::DatastoreClient(g::datastore_v1::MakeDatastoreConnection(
g::Options{}
.set<g::EndpointOption>("localhost:9019")
.set<g::CredentialsOption>(g::MakeInsecureCredentials()))); You may also find this useful: https://cloud.google.com/cpp/docs/reference/datastore/latest/datastore-env |
@coryan thanks. just a small try i get these errors
the same is true with
UPDATE: My bad. After checking the change log, I noticed we are now at version 2.24... |
Sorry about that. That is found in
Argh. I should have said
|
@coryan Thank you. I managed to get that set up. But it still is not working as smoothly as I would have wanted it to. I thought it would connect seamlessly to the Firebase Firestore emulator at port localhost:9019 as the storage API does with the provided Firebase Storage port 9199. Instead when I do a simple datastore firestore in native mode database manipulation like updating or querying, I get this error:
Just to clear things up, my datastore here is in firestore-native mode. I am using the datastore API because C++ has no Firestore direct app for web. Is what I am trying to do even possible?
|
Apologies, I completely misunderstood what you were trying to do. I may still be wrong about what you are trying to do. I just sent #14100, with that change I was able to run the quickstart against the emulator embedded with the With that said, these two tests worked for me: # In a separate shell run the datastore emulator.
gcloud beta emulators datastore start --host-port=localhost:9019
DATASTORE_EMULATOR_HOST=localhost:9019 bazel run -- //google/cloud/datastore/quickstart:quickstart foobar # In a separate shell run the firestore emulator in datastore mode.
gcloud emulators firestore start --database-mode=datastore-mode --host-port=localhost:9019
DATASTORE_EMULATOR_HOST=localhost:9019 bazel run -- //google/cloud/datastore/quickstart:quickstart foobar
TIL: firebase has an emulator for Google Cloud Storage. I am glad it works for you, but we don't test against it. If you run into trouble, we (the |
Okay, this is how it goes. I start my Firebase emulators with: └─────────────────────────────────────────────────────────────┘ ┌───────────┬────────────────┬─────────────────────────────────┐ |
I cannot find any documentation that suggests you can run the firebase emulators:start --only functions,storage
gcloud emulators firestore start --database-mode=datastore-mode --host-port=localhost:9019 |
What component of
google-cloud-cpp
is this feature request for? ForGoogle cloud datastore(native mode)
Is your feature request related to a problem? Please describe.
I can't seem to be able to get my program to use the local development server.
Describe the solution you'd like
Okay, I may be out of place here, but I can use the Google-cloud-cpp to make connections to my local cloud storage, which is great.
I don't seem to find any direct way to do the same through the datastore. I want to use my local datastore or Firebase Firestore emulator as my datastore is in native mode. Is this an overkill, or is there no real need for such usage?
Describe alternatives you've considered
Trying to use just environment variables here, haven't seemed to work for me.
Better
I would like to connect my application to use my Firestore emulator when in development just like I am able to use the Cloud Storage emulator. Any help here would save a life :).
The text was updated successfully, but these errors were encountered: