Created
December 19, 2019 10:43
-
-
Save pc035860/b4580c33f5e8013992fd6e62daf9c4ee to your computer and use it in GitHub Desktop.
Generate command for setting Firebase Functions Environment
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
/** | |
* @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