Yes, it works! Because the emulator starts, sets the required env vars, requirements are installed and finally the app is served, but with stripped env vars, then additional ones are taken from app.yaml or manually provided by the dev_appserver.py (as above). Don't forget to mention its port also with "--datastore_emulator_port 8088" for example.
miercuri, 20 iunie 2018, 23:40:04 UTC+3, Kai Wang a scris: > > Actually, "cloud.google.com/go/datastore" should also work. However, at > this moment, you *have to* pass the DATASTORE_EMULATOR_HOST with the > '--env_var' flag to dev_appserver: > --env_var DATASTORE_EMULATOR_HOST=localhost:8088 > > Please try this flag, hopefully it should work :) > > Dev_appserver currently prunes shell env vars from local golang runtime > process. The '--env_var' flag allows you to pass environment variable to > the local go runtime process. > > On Tue, Jun 19, 2018 at 5:54 PM Kai Wang <[email protected] <javascript:>> > wrote: > >> Hi Giuliano, >> >> Note that, for app engine standard runtime go, the recommended datastore >> library >> <https://cloud.google.com/appengine/docs/standard/go/datastore/reference> >> is >> "google.golang.org/appengine/datastore". I've verified on my side this >> library works with dev_appserver + datastore emulator. >> >> As for "cloud.google.com/go/datastore". I am not every sure how to make >> it work in App Engine standard app. I do have verified this cloud >> library can speak to the datastore emulator when it is *outside of *App >> Engine dev_appserver. Unfortunately I've not been able to make this library >> work inside an app engine golang app. Could you kindly attach some code >> snippet, such that run a simple GAE go app with the cloud datastore library? >> >> Detected environment variable DATASTORE_EMULATOR_HOST=localhost:9999, >> >> FYI, are you sure the emulator ran on localhost:9999 ? >> >> Thank you so much for trying this feature. >> >> I am all ears to follow up :) >> >> On Fri, Jun 1, 2018 at 6:25 AM Giuliano Ribeiro <[email protected] >> <javascript:>> wrote: >> >>> When I setup the local env, see the log: >>> WARNING 2018-06-01 13:21:25,741 api_server.py:581] Detected environment >>> variable DATASTORE_EMULATOR_HOST=localhost:9999, dev_appserver will speak >>> to the Cloud Datastore emulator running on this address. The datastore_path >>> /var/folders/n4/vq69gqrn3470jyqdp1sxp2ww0000gn/T/appengine.None.gribeiro/datastore.db >>> >>> will be neglected. >>> If you want datastore to store on >>> /var/folders/n4/vq69gqrn3470jyqdp1sxp2ww0000gn/T/appengine.None.gribeiro/datastore.db, >>> >>> remove DATASTORE_EMULATOR_HOST from environment variables and restart >>> dev_appserver >>> >>> And my app still writing/reading from the cloud. >>> >>> On Wednesday, May 30, 2018 at 6:55:32 PM UTC+1, Kai Wang wrote: >>>> >>>> According to the documentation >>>> <https://cloud.google.com/datastore/docs/tools/datastore-emulator#setting_environment_variables>, >>>> >>>> you need to have the env var "DATASTORE_EMUALTOR_HOST" set. >>>> >>>> Also, FYI, this "cloud.google.com/go/datastore" (officially, it is >>>> called Google Cloud Client Library), should be able to connect to the >>>> datatore emulator, no matter the code runs inside or outside of the >>>> dev_appserver. >>>> >>>> Please check the env var and lmk if they work :) >>>> >>>> On Wednesday, May 30, 2018 at 6:39:05 AM UTC-7, Giuliano Ribeiro wrote: >>>>> >>>>> Hi Kai Wang, I'm using "cloud.google.com/go/datastore" >>>>> As I read in the documentation this datastore package support the >>>>> emulator, I was thinking it should be easy to use. But even enabling the >>>>> emulator in the dev_appserver, my app is reading and writing directly in >>>>> the cloud, ignoring the emulator. >>>>> >>>>> Thanks, >>>>> >>>>> On Tuesday, May 29, 2018 at 8:08:08 PM UTC+1, Kai Wang wrote: >>>>>> >>>>>> Hi Glullano, >>>>>> >>>>>> What go libraries are you using? Is it >>>>>> google.golang.org/appengine/datastore (link >>>>>> <https://cloud.google.com/appengine/docs/standard/go/datastore/reference>) >>>>>> >>>>>> ? >>>>>> Did it store locally before? >>>>>> >>>>>> You can email [email protected] for further details :) >>>>>> >>>>>> >>>>>> On Friday, May 25, 2018 at 9:04:42 AM UTC-7, Giuliano Ribeiro wrote: >>>>>>> >>>>>>> Really nice, but how to put it to work ? >>>>>>> I'm using with Go, even setting up to true, my app still saving data >>>>>>> in the cloud. >>>>>>> >>>>>>> Thank you, >>>>>>> >>>>>>> >>>>>>> On Wednesday, May 16, 2018 at 9:57:42 PM UTC+1, Steren Giannini >>>>>>> wrote: >>>>>>>> >>>>>>>> Dear App Engine users, >>>>>>>> >>>>>>>> We are pleased to announce that the App Engine local development >>>>>>>> server (dev_appserver) is now compatible with the Cloud Datastore >>>>>>>> Emulator >>>>>>>> <https://cloud.google.com/datastore/docs/tools/datastore-emulator>. >>>>>>>> >>>>>>>> You can opt-in to this feature by running: >>>>>>>> * dev_appserver.py --support_datastore_emulator* >>>>>>>> >>>>>>>> By using the --support_datastore_emulator flag, dev_appserver will >>>>>>>> use Cloud Datastore Emulator for local datastore emulation. You can >>>>>>>> read >>>>>>>> more about the migration process here >>>>>>>> <https://cloud.google.com/appengine/docs/standard/python/tools/migrate-cloud-datastore-emulator> >>>>>>>> . >>>>>>>> The development server and Cloud Datastore Emulator support the >>>>>>>> interoperation of ndb and Cloud Datastore client libraries. >>>>>>>> >>>>>>>> Please help us test this feature. Our goal is to enable it by >>>>>>>> default in the future. >>>>>>>> Please share your feedback by replying directly to this thread. We >>>>>>>> are looking forward to it! >>>>>>>> >>>>>>>> Thanks, >>>>>>>> Steren >>>>>>>> Product Manager >>>>>>>> Google Cloud >>>>>>>> >>>>>>> >>>>>>> >>>>>>> <https://lp.google-mkto.com/index.php/email/emailWebview?mkt_tok=eyJpIjoiWkdNM09UQTVOek0wWmpabSIsInQiOiJLTUp1dEptSzBXaVF3WmNFd3FMTGdJN2swY3dCNUFlNmVrOWVZWllxXC95OHVEdGRacHhkUmxZRkZOXC9TbEx4bkhWRnlES3RrU1hlWkVkMEFudkdMb1h3PT0ifQ%3D%3D> >>>>>> >>>>>> >>>>> >>>>> <https://lp.google-mkto.com/index.php/email/emailWebview?mkt_tok=eyJpIjoiWkdNM09UQTVOek0wWmpabSIsInQiOiJLTUp1dEptSzBXaVF3WmNFd3FMTGdJN2swY3dCNUFlNmVrOWVZWllxXC95OHVEdGRacHhkUmxZRkZOXC9TbEx4bkhWRnlES3RrU1hlWkVkMEFudkdMb1h3PT0ifQ%3D%3D> >>>> >>>> >>> >>> <https://lp.google-mkto.com/index.php/email/emailWebview?mkt_tok=eyJpIjoiWkdNM09UQTVOek0wWmpabSIsInQiOiJLTUp1dEptSzBXaVF3WmNFd3FMTGdJN2swY3dCNUFlNmVrOWVZWllxXC95OHVEdGRacHhkUmxZRkZOXC9TbEx4bkhWRnlES3RrU1hlWkVkMEFudkdMb1h3PT0ifQ%3D%3D> >>> >>> >>> -- >>> You received this message because you are subscribed to a topic in the >>> Google Groups "Google App Engine" group. >>> To unsubscribe from this topic, visit >>> https://groups.google.com/d/topic/google-appengine/vyzCiWKOngc/unsubscribe >>> . >>> To unsubscribe from this group and all its topics, send an email to >>> [email protected] <javascript:>. >>> To post to this group, send email to [email protected] >>> <javascript:>. >>> Visit this group at https://groups.google.com/group/google-appengine. >>> To view this discussion on the web visit >>> https://groups.google.com/d/msgid/google-appengine/edfbf328-bab1-47ce-9e39-9f5734229582%40googlegroups.com >>> >>> <https://groups.google.com/d/msgid/google-appengine/edfbf328-bab1-47ce-9e39-9f5734229582%40googlegroups.com?utm_medium=email&utm_source=footer> >>> . >>> For more options, visit https://groups.google.com/d/optout. >>> >> -- You received this message because you are subscribed to the Google Groups "Google App Engine" group. To unsubscribe from this group and stop receiving emails from it, send an email to [email protected]. To post to this group, send email to [email protected]. Visit this group at https://groups.google.com/group/google-appengine. To view this discussion on the web visit https://groups.google.com/d/msgid/google-appengine/89a9c661-91c6-40e1-b800-1be79b1fb514%40googlegroups.com. For more options, visit https://groups.google.com/d/optout.
