Last active
October 14, 2018 12:02
-
-
Save flatfisher/3c1933adf933babac43b35e08b2102f2 to your computer and use it in GitHub Desktop.
Cloud Functions で環境変数を使う ref: https://qiita.com/flatfisher/items/e10a8e3f5dad2b2b4e71
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
PROJECT: hogehoge | |
KEY: fugafuga |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
$ gcloud beta functions NAME --set-env-vars PROJECT=hogehoge KEY=fugafuga |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
exports.envVar = (req, res) => { | |
// Sends 'bar' as response | |
res.send(process.env.PROJECT); | |
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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