
Security News
Meet Socket at Black Hat and DEF CON 2025 in Las Vegas
Meet Socket at Black Hat & DEF CON 2025 for 1:1s, insider security talks at Allegiant Stadium, and a private dinner with top minds in software supply chain security.
cloud-functions-runtime-config
Advanced tools
This is a wrapper around Google API Client to read Runtime Config variables in Cloud Functions.
This is a wrapper around Google API Client to read Runtime Config variables in Cloud Functions.
Note: Runtime Config is currently in beta so things might break!
npm install --save cloud-functions-runtime-config
const runtimeConfig = require('cloud-functions-runtime-config');
const lunchPlans = runtimeConfig.getVariable('dev-config', 'lunch-plans');
exports.lunchPlanner = (req, res) => {
return lunchPlans
.then((val) => {
console.log(val);
res.status(200).send(val);
})
.catch((err) => {
console.error(err);
res.status(500).send(err);
});
};
Either using the API Manager in Cloud Console or using gcloud:
gcloud service-management enable runtimeconfig.googleapis.com
Create a config resource and store a variable in it.
gcloud beta runtime-config configs create dev-config
gcloud beta runtime-config configs variables \
set lunch-plans "lets go for a hamburger!" \
--config-name dev-config
A basic HTTP Function that returns the variable value.
const runtimeConfig = require('cloud-functions-runtime-config');
const lunchPlans = runtimeConfig.getVariable('dev-config', 'lunch-plans');
exports.lunchPlanner = (req, res) => {
return lunchPlans
.then((val) => res.status(200).send(val))
.catch((err) => res.status(500).send(err));
};
Deploying the Function with an HTTP trigger:
gcloud beta functions deploy lunchPlanner \
--trigger-http \
--stage-bucket=<YOUR-BUCKET>
Test the Function:
curl https://us-central1-$(gcloud config get-value core/project).cloudfunctions.net/lunchPlanner
gcloud beta runtime-config configs delete dev-config
gcloud beta functions delete lunchPlanner
Returns a Promise
that is either resolved to the value read from Runtime Config or rejected if the variable could not be read.
Type: string
Type: string
Returns a Promise
that is either resolved to an Array
of values or rejected if any of the variables could not be read.
The values are returned in the same order as the variableNames.
Type: string
Type: Array<string>
0.4.0
Upgraded package dependencies.
FAQs
This is a wrapper around Google API Client to read Runtime Config variables in Cloud Functions.
The npm package cloud-functions-runtime-config receives a total of 7 weekly downloads. As such, cloud-functions-runtime-config popularity was classified as not popular.
We found that cloud-functions-runtime-config demonstrated a not healthy version release cadence and project activity because the last version was released a year ago. It has 1 open source maintainer collaborating on the project.
Did you know?
Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.
Security News
Meet Socket at Black Hat & DEF CON 2025 for 1:1s, insider security talks at Allegiant Stadium, and a private dinner with top minds in software supply chain security.
Security News
CAI is a new open source AI framework that automates penetration testing tasks like scanning and exploitation up to 3,600× faster than humans.
Security News
Deno 2.4 brings back bundling, improves dependency updates and telemetry, and makes the runtime more practical for real-world JavaScript projects.