ruby - 无法从 Rails 6 应用程序的 Google Secret Manager 检索密钥
问题描述
按照Secret Manager 文档,我创建了一个秘密,现在我尝试以编程方式检索它。我的实现如下所示:
require 'google/cloud/secret_manager'
class SecretManager
def self.read(secret_id)
return unless secret_id
Google::Cloud::SecretManager.secret_manager_service.access_secret_version(
name: "projects/my-test-project/secrets/#{secret_id}/versions/latest"
).payload.data
end
end
在执行时,我得到以下信息:
irb(main):001:0> SecretManager.read('my-test-key')
objc[9757]: +[__NSCFConstantString initialize] may have been in progress in another thread when fork() was called.
objc[9757]: +[__NSCFConstantString initialize] may have been in progress in another thread when fork() was called. We cannot safely call it or ignore it in the fork() child process. Crashing instead. Set a breakpoint on objc_initializeAfterForkError to debug.
另外,我发现了这个问题(大约 2 岁):https ://bugs.ruby-lang.org/issues/14009但建议的解决方案对我不起作用。
我正在运行 OSX 10.14.6、Ruby 2.6.5、Rails 6.0.2.1
解决方案
推荐阅读
- javascript - 更新子组件时的 StencilJS 事件
- kubernetes - GKE 托管证书未通过 HTTPS 提供服务
- php - PHP MongoDB\Client updateOne 将新字段添加到现有文档数组
- ruby-on-rails - 如何在 img 标签上的 src 属性上使用 web_mock 存根 headless_chrome 申请
- string - 将日期格式从 DD.MM.YYYY 转换为 YYYY-MM-DD
- php - 对于末尾带有表单的单页网站:我是否必须将 index.html 转换为 index.php?
- svg - 重复内联 svg 模式
- excel - 使用打开的 Windows 资源管理器并选择文件以在 Internet Explorer 上上传文件
- ruby-on-rails - 如何让多租户 Rails 应用程序/ActiveRecord 为不同区域的租户存储日期/时间?
- javascript - 在 Vue JS 组件模板中定义默认发出事件