Skip to content

Instantly share code, notes, and snippets.

@flatfisher
Last active October 14, 2018 12:02
Show Gist options
  • Save flatfisher/3c1933adf933babac43b35e08b2102f2 to your computer and use it in GitHub Desktop.
Save flatfisher/3c1933adf933babac43b35e08b2102f2 to your computer and use it in GitHub Desktop.
Cloud Functions で環境変数を使う ref: https://qiita.com/flatfisher/items/e10a8e3f5dad2b2b4e71
PROJECT: hogehoge
KEY: fugafuga
$ gcloud beta functions NAME --set-env-vars PROJECT=hogehoge KEY=fugafuga
exports.envVar = (req, res) => {
// Sends 'bar' as response
res.send(process.env.PROJECT);
};
def env_vars(request):
return os.environ.get('KEY', 'Specified environment variable is not set.')
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment