且构网

分享程序员开发的那些事...
且构网 - 分享程序员编程开发的那些事

在生产应用中使用Google凭据的***方法是什么?

更新时间:2023-12-02 10:35:04

您可以使用Google KMS设置凭据,并在您的应用程序中使用它 https://cloud.google.com/kms/.

You can set credentials using Google KMS and consume it in your application https://cloud.google.com/kms/.

1a.将JSON作为KEY值的JSON保存在KMS中.

1a. Save the JSON in a KMS as a JSON for the VALUE of the KEY.

2a.解密代码中的JSON并使用它.

2a. Decrypt JSON in your code and consume it.

1b.另外,您也可以使用环境变量使用它的凭据

1b. Alternatively, you can make it consume credentials using Environment variables

2b.只需在要交付应用程序的环境中设置环境.

2b. And just setup Environments in your environment where you app is being shipped.

3b.您可以使用无服务器框架等工具( https://serverless.com/framework/docs/providers/google/)

3b. You can automate 2b step using some tool like serverless framework( https://serverless.com/framework/docs/providers/google/)