added guard for firebase-config init call without creentials set
This commit is contained in:
@ -31,13 +31,16 @@ module.exports = function(RED) {
|
|||||||
});
|
});
|
||||||
global.set('firebase', _admin)
|
global.set('firebase', _admin)
|
||||||
}
|
}
|
||||||
console.log('********************************************************** setting storage....')
|
if(this.credentials){
|
||||||
|
//console.log('********************************************************** setting storage.... credentials are')
|
||||||
|
//console.dir(this.credentials)
|
||||||
s = new Storage({
|
s = new Storage({
|
||||||
//projectId: 'something-2e584',
|
projectId: this.credentials.project_id,
|
||||||
//email: 'firebase-adminsdk-d1xiy@something-2e584.iam.gserviceaccount.com',
|
//email: 'firebase-adminsdk-d1xiy@something-2e584.iam.gserviceaccount.com',
|
||||||
credentials: this.credentials
|
credentials: this.credentials
|
||||||
})
|
})
|
||||||
global.set('cloud-storage', s)
|
global.set('cloud-storage', s)
|
||||||
|
}
|
||||||
|
|
||||||
//s = new Storage()
|
//s = new Storage()
|
||||||
|
|
||||||
|
|||||||
@ -43,7 +43,7 @@
|
|||||||
}
|
}
|
||||||
},
|
},
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
"@google-cloud/storage": "^3.0.2",
|
"@google-cloud/storage": "^3.0.3",
|
||||||
"@node-red/runtime": "^0.20.6",
|
"@node-red/runtime": "^0.20.6",
|
||||||
"firebase-admin": "^8.0.0"
|
"firebase-admin": "^8.0.0"
|
||||||
}
|
}
|
||||||
|
|||||||
@ -12,9 +12,15 @@ module.exports = function(RED) {
|
|||||||
this.storage = c.storage
|
this.storage = c.storage
|
||||||
this.bucket = config.bucket || c.bucket
|
this.bucket = config.bucket || c.bucket
|
||||||
this.path = config.path
|
this.path = config.path
|
||||||
|
/*
|
||||||
|
console.log('configuring storage-write to listen for messages. config is')
|
||||||
|
console.dir(config)
|
||||||
|
console.log('storage is')
|
||||||
|
console.dir(this.storage)
|
||||||
|
*/
|
||||||
}
|
}
|
||||||
|
|
||||||
//console.log('configuring storage-write to listen for messages')
|
|
||||||
node.on('input', function(msg) {
|
node.on('input', function(msg) {
|
||||||
if(msg && msg.payload){
|
if(msg && msg.payload){
|
||||||
let path = msg.payload.path || msg.path|| this.path
|
let path = msg.payload.path || msg.path|| this.path
|
||||||
|
|||||||
Reference in New Issue
Block a user