Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
const { Firestore } = require('@google-cloud/firestore');
const fs = require('fs');
const Multiprogress = require('multi-progress');
const multi = new Multiprogress(process.stdout);
// In your index.js
const firestoreService = require('firestore-export-import');
const serviceAccount = require('./service-account-beta.json');
// Initiate Firebase App
firestoreService.initializeApp(serviceAccount, 'https://ffxiv-teamcraft-beta.firebaseio.com');
// Start exporting your data
// Create a new client
const firestore = new Firestore();
const backupFile = './lists.json';
const allLists = Object.entries(JSON.parse(fs.readFileSync(backupFile, 'utf8').trim() || '[]')).map(([k, v]) => {
return {
...v,
$key: k
};
});
console.log('Lists cache loaded', allLists.length);
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License
*
*/
const fei = require('firestore-export-import');
import * as admin from 'firebase-admin';
import path from 'path';
import fs from 'fs';
const DEFAULT_CONFIG_FILE = path.resolve(__dirname, '../data/firebase-admin-key.json');
const DATABASE_URL = 'https://pie-shop-app.firebaseio.com';
if (process.env.FB_KEYS) {
// Try the environment variable first
fei.initializeApp(require(process.env.FB_KEYS), DATABASE_URL);
} else if (fs.existsSync(DEFAULT_CONFIG_FILE)) {
// Check the default config file second
fei.initializeApp(require(DEFAULT_CONFIG_FILE), DATABASE_URL);
} else {
// Hopefully in Cloud env and can use default credentials
admin.initializeApp({
credential: admin.credential.applicationDefault(),
databaseURL: DATABASE_URL,
});
admin.firestore().settings({timestampsInSnapshots: true});
}
let homeData;
let productData;
export function getHomeData() {