From 6ed3d21a4f62d19ab0f41bacc5d8077132d05d01 Mon Sep 17 00:00:00 2001 From: Peter Svensson Date: Tue, 16 Jul 2019 11:18:15 +0200 Subject: [PATCH] adding guard for other components already initalized firebase-admin --- firebase-config.js | 5 ++++- package.json | 2 +- 2 files changed, 5 insertions(+), 2 deletions(-) diff --git a/firebase-config.js b/firebase-config.js index 34b725d..7ba8c9f 100644 --- a/firebase-config.js +++ b/firebase-config.js @@ -1,7 +1,7 @@ const _admin = require('firebase-admin') const {Storage} = require('@google-cloud/storage'); -let global = this.context().global + let init = !(_admin.apps.length === 0) let s @@ -29,6 +29,8 @@ module.exports = function(RED) { databaseURL: this.dburl }); + let global = this.context().global + global.set('firebase', _admin) console.log('setting storage....') @@ -38,6 +40,7 @@ module.exports = function(RED) { credentials: this.credentials }) + global.set('cloud-storage', s) //s = new Storage() diff --git a/package.json b/package.json index cec90b2..a64d6ac 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "node-red-contrib-firebase-admin", - "version": "1.1.8", + "version": "1.1.9", "description": "A node-red module that wraps the server-side admin SDK of firebase, firestore, et.c.", "main": "index.js", "scripts": {