Assume, you have a Firebase project with Cloud Functions and Firebase CLI.
To set the config (environment) you need to run the following command in the project’s folder:
firebase functions:config:set <key>=<value>
For example:
firebase functions:config:set youtube.key="AIzaSyAaNK8gBK7dTtMuSrNSozNTiiy5-02fIof”
We can check the existing environment config by running:
firebase functions:config:get
Let us say:
In order to get the adjusted config in the cloud function, we need to import the firebase-functions
and run the config
method. I.e:
const config = functions.config();
const youtube = google.youtube({
version: "v3",
auth: config.youtube.key,
});