按照https://cloud.google.com/datastore/docs/tools/datastore-emulator中的说明,我不确定是否遗漏了任何内容
除非我使用DataStoreClient显式创建数据存储,否则我无法连接到本地模拟器.
DatastoreDb db = DatastoreDb.Create(projectId, string.Empty, new DatastoreClientImpl(
new Datastore.DatastoreClient(
new Channel("localhost", 8081, ChannelCredentials.Insecure)), new DatastoreSettings()));
Run Code Online (Sandbox Code Playgroud)
而不仅仅是 DatastoreDb.Create(projectId);
如果我们在GKE中进行生产,我们需要连接到实际的数据存储而不是模拟器,我们如何区分具有相同代码库的两个版本.
有没有办法检查代码是否正在运行GKE,或者这是应该通过环境变量来完成的,以获得最佳结果.
c# google-cloud-datastore google-cloud-platform google-kubernetes-engine