繁体   English   中英

连接谷歌云数据存储模拟器

[英]connection Google cloud datastore emulator

我已经在我的本地机器上安装了 google 数据存储模拟器,同时它还编写了一个示例 spring 启动应用程序。 我无法连接数据存储模拟器

这是我的 application.properties 配置

spring.cloud.gcp.datastore.project-id=project-id
spring.cloud.gcp.datastore.emulator.enabled=true
spring.cloud.gcp.datastore.emulator-host=http://localhost:8081

通过这个配置,我会抛出异常

The Application Default Credentials are not available. They are available if running in Google Compute Engine. Otherwise, the environment variable GOOGLE_APPLICATION_CREDENTIALS must be defined pointing to a file defining the credentials. See https://developers.google.com/accounts/docs/application-default-credentials for more information.

使用Datastore 模拟器时,您不需要凭据来运行应用程序,因此可能不知道这一点。

但是,如果您想尝试它提供凭据,一旦您创建了服务帐户,然后在 shell 中运行以下命令:

export GOOGLE_APPLICATION_CREDENTIALS="KEY_PATH"

KEY_PATH您必须将其替换为包含您的服务帐户密钥的 JSON 文件的路径。 您可以在此处找到更多信息。

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM