What is the common practice here? There seems to be no tools provided by gcloud
. I\'m deploying functions from local machine for now, so I can hardcode secrets, but
Since making my comment, I've found a relatively simple way to do this - provide a config .json
file. Here's an example I hacked together based on their Slack function example:
config.json file 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);
};
When you deploy the function and go to the URL, you should get the response bar
.
Pros and cons:
Pros:
.gitignore
to ensure your secrets don't end up the repoCons:
On the whole, it's a far cry from a real secrets management system, but it's workable enough to hold me over until this feature eventually makes it into the Cloud Functions core.