按照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