adding guard for other components already initalized firebase-admin
This commit is contained in:
@ -1,7 +1,7 @@
|
|||||||
const _admin = require('firebase-admin')
|
const _admin = require('firebase-admin')
|
||||||
const {Storage} = require('@google-cloud/storage');
|
const {Storage} = require('@google-cloud/storage');
|
||||||
|
|
||||||
let global = this.context().global
|
|
||||||
let init = !(_admin.apps.length === 0)
|
let init = !(_admin.apps.length === 0)
|
||||||
let s
|
let s
|
||||||
|
|
||||||
@ -29,6 +29,8 @@ module.exports = function(RED) {
|
|||||||
databaseURL: this.dburl
|
databaseURL: this.dburl
|
||||||
});
|
});
|
||||||
|
|
||||||
|
let global = this.context().global
|
||||||
|
|
||||||
global.set('firebase', _admin)
|
global.set('firebase', _admin)
|
||||||
console.log('setting storage....')
|
console.log('setting storage....')
|
||||||
|
|
||||||
@ -38,6 +40,7 @@ module.exports = function(RED) {
|
|||||||
credentials: this.credentials
|
credentials: this.credentials
|
||||||
})
|
})
|
||||||
|
|
||||||
|
|
||||||
global.set('cloud-storage', s)
|
global.set('cloud-storage', s)
|
||||||
|
|
||||||
//s = new Storage()
|
//s = new Storage()
|
||||||
|
|||||||
@ -1,6 +1,6 @@
|
|||||||
{
|
{
|
||||||
"name": "node-red-contrib-firebase-admin",
|
"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.",
|
"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": {
|
||||||
|
|||||||
Reference in New Issue
Block a user