Is it possible to set environment variables for GCF so that all that settings would be visible to all functions? Or maybe there are some options to configure it in project's scope?
I'm just need a mechanism to parametrize all environments, like local-dev, dev, stage, prod for functions. For now I'm trying setup local datastore emulator and setup local development/debugging/testing workflow without writing if statements inside code. As I found such things can be configured through env. veriables, but I'm don't know how it would work on target platform in cloud.
In future staging will be made by division environments onto separate cloud projects with their's own databases and storages as well as env. variables.
Is it possible or is there any solution for something like that?
To set, update, or remove environment variables of an existing service, use the gcloud run services update command. You can use any of the following flags, as needed: --set-env-vars. --update-env-vars.
Google Cloud Functions is a serverless execution environment for building and connecting cloud services. With Cloud Functions you write simple, single-purpose functions that are attached to events emitted from your cloud infrastructure and services.
Not saying that Deployment Manager would not handle those the same way (although I could not spot it accurately), this below sounds like the closest answer to what you're talking about :
https://github.com/fredriks/cloud-functions-runtime-config/blob/master/README.md
Besides this example being an npm package, it shows clearly the gcloud commands to run.
It is important to activate the concerned api, as explained here (see 'before you begin')
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With