How to handle secrets in Google cloud features?

What is common practice here? There seems to be no tools provided gcloud. I am now deploying functions from the local machine, so I can write secrets, but this seems out of place. Also, what about CI / CD? In this case, I will need to pass secrets as environment variables. Is it possible that this is possible?

+4
source share
1 answer

Since creating my comment, I have found a relatively simple way to do this - to provide a config file .json. Here is an example that I hacked based on an example Slack function:

config.json in the same directory as index.js :

{
  "foo": "bar"
}

index.js

const config = require('./config.json');

exports.envTest = (req, res) => {
  res.status(200).send(config.foo);
};

URL-, bar.

:

:

  • IDE
  • .gitignore,
  • ,

:

  • Clunky
  • , .
  • Google Cloud,

, , , , ​​ .

+2

Source: https://habr.com/ru/post/1690309/


All Articles