blob: 3b100a8237b42f14aa608ac2366bbdad49c09eb9 [file] [log] [blame]
/**
* HTTP Cloud Function for testing volume mount Secrets.
*/
const fs = require('fs')
exports.echoSecret = (req, res) => {
const path = '/etc/secrets/test-secret'
fs.access(path, fs.F_OK, (err) => {
if (err) {
console.error(err)
res.status(200).send(err)
return
}
fs.readFile(path, 'utf8', function (err, data) {
res.status(200).send("Secret: " + data)
});
})
};