Last active
May 2, 2019 14:39
-
-
Save evilUrge/2905b5fdf8eb3a82dd6eaa6fb46e714e to your computer and use it in GitHub Desktop.
Fetch configurations from Firestore's collection "configurations" as json files.
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
process.env.NODE_ENV = process.env.NODE_ENV ? process.env.NODE_ENV : 'development'; | |
require('../src/firebase').admin.firestore().collection('configurations').get() | |
.then(documents => | |
documents.forEach((document) => | |
require('fs').writeFile(`${require('../src/utils').baseDir}/config/${document.id}.json`, JSON.stringify(document.data()), (error) => | |
error ? console.error(error) : console.log(`Configuration file ${document.id}.json has been created!`)))); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment