Skip to content

Instantly share code, notes, and snippets.

@pc035860
Created December 19, 2019 10:43
Show Gist options
  • Save pc035860/b4580c33f5e8013992fd6e62daf9c4ee to your computer and use it in GitHub Desktop.
Save pc035860/b4580c33f5e8013992fd6e62daf9c4ee to your computer and use it in GitHub Desktop.
Generate command for setting Firebase Functions Environment
/**
* @param config {object} environment config object
*
* {
* [serviceName]: {
* [key]: "{value}",
* ...
* },
* ...
* }
**/
function generateCommand(config) {
let list = [];
for(let [serviceName, serviceObject] of Object.entries(config)) {
for (let [key, value] of Object.entries(serviceObject)) {
list.push(`${serviceName}.${key}="${value}"`);
}
}
return `firebase functions:config:set ${list.join(" ")}`;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment