adding guard for other components already initalized firebase-admin

This commit is contained in:
Peter Svensson
2019-07-16 12:44:36 +02:00
parent 6ba94648e0
commit 6c308fec3e
3 changed files with 8 additions and 4 deletions

View File

@ -32,7 +32,7 @@ module.exports = function(RED) {
let global = this.context().global let global = this.context().global
global.set('firebase', _admin) global.set('firebase', _admin)
console.log('setting storage....') console.log('********************************************************** setting storage....')
s = new Storage({ s = new Storage({
//projectId: 'something-2e584', //projectId: 'something-2e584',

View File

@ -1,6 +1,6 @@
{ {
"name": "node-red-contrib-firebase-admin", "name": "node-red-contrib-firebase-admin",
"version": "1.1.10", "version": "1.1.11",
"description": "A node-red module that wraps the server-side admin SDK of firebase, firestore, et.c.", "description": "A node-red module that wraps the server-side admin SDK of firebase, firestore, et.c.",
"main": "index.js", "main": "index.js",
"scripts": { "scripts": {

View File

@ -1,5 +1,5 @@
let storage
module.exports = function(RED) { module.exports = function(RED) {
function FirebaseAdmin(config) { function FirebaseAdmin(config) {
@ -14,9 +14,13 @@ module.exports = function(RED) {
storage = this.storage storage = this.storage
this.bucket = config.bucket || c.bucket this.bucket = config.bucket || c.bucket
this.path = config.path this.path = config.path
console.log('storage-read set this.storage') console.log('storage-read set this.storage to '+c.storage)
console.log('config is '+config)
} }
let global = this.context().global
this.torage = global.get('cloud-storage')
//console.log('configuring storage-read to listen for messages') //console.log('configuring storage-read to listen for messages')
node.on('input', function(msg) { node.on('input', function(msg) {
if(msg && msg.payload){ if(msg && msg.payload){