Security News
pnpm 10.0.0 Blocks Lifecycle Scripts by Default
pnpm 10 blocks lifecycle scripts by default to improve security, addressing supply chain attack risks but sparking debate over compatibility and workflow changes.
gcf-runtime-config
Advanced tools
Environment Variables within Google Cloud Functions through Runtime Config
gcf-runtime-config
helps you
get environment variables within Google Cloud Functions (GCF) through
Runtime Config
.
$ npm install --save gcf-runtime-config
$ gcloud services enable runtimeconfig.googleapis.com
Create a new config:
$ gcloud beta runtime-config configs create EXAMPLE_ENVIRONMENT
$ gcloud beta runtime-config configs variables \
set PAYPAL_SECRET_KEY "NOTREAL1234!@#$" \
--config-name EXAMPLE_ENVIRONMENT \
--is-text
$ gcloud beta runtime-config configs variables \
set STRIPE_SECRET_KEY "YESREAL1234!@#$" \
--config-name EXAMPLE_ENVIRONMENT \
--is-text
const gcfRuntimeConfig = require('gcf-runtime-config');
exports.testRuntimeConfig = (req, res) => {
gcfRuntimeConfig
.getVariables('EXAMPLE_ENVIRONMENT')
.then(variablesObj => res.send(variablesObj))
.catch(err => res.send(err));
};
The example
directory is a ready-to-deploy sample function that uses
gcf-runtime-config
and extracts a runtime config (environment).
$ gcloud beta functions deploy testExpressApp --trigger-http
$ curl https://<YOUR_PROJECT>.cloudfunctions.net/testRuntimeConfig
{"PAYPAL_SECRET_KEY":"NOTREAL1234!@#$","STRIPE_SECRET_KEY":"YESREAL1234!@#$"}
$ gcloud beta functions delete testExpressApp
Arguments:
EXAMPLE_ENVIRONMENT
.{"PAYPAL_SECRET_KEY":"NOTREAL1234!@#$","STRIPE_SECRET_KEY":"YESREAL1234!@#$"}
[{"name":"STRIPE_SECRET_KEY","updateTime":"2018-05-20T09:53:11.383980095Z","text":"YESREAL1234!@#$"},{"name":"PAYPAL_SECRET_KEY","updateTime":"2018-05-20T09:53:09.683262561Z","text":"NOTREAL1234!@#$"}]
Returns:
A Promise
that depending on objectify
resolves to either an object where its
keys and values are the config's parameters and values or to an array of parameter objects.
We needed a way to inject secret keys to a Google Cloud Function. Storing keys in code base is wrong.
MIT
FAQs
Environment Variables within Google Cloud Functions through Runtime Config
The npm package gcf-runtime-config receives a total of 1 weekly downloads. As such, gcf-runtime-config popularity was classified as not popular.
We found that gcf-runtime-config demonstrated a not healthy version release cadence and project activity because the last version was released a year ago. It has 3 open source maintainers 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
pnpm 10 blocks lifecycle scripts by default to improve security, addressing supply chain attack risks but sparking debate over compatibility and workflow changes.
Product
Socket now supports uv.lock files to ensure consistent, secure dependency resolution for Python projects and enhance supply chain security.
Research
Security News
Socket researchers have discovered multiple malicious npm packages targeting Solana private keys, abusing Gmail to exfiltrate the data and drain Solana wallets.