experimenting with getting credentials as needed instead of setting them at node-creation

This commit is contained in:
Peter Svensson
2020-04-23 20:05:02 +02:00
parent c7941c2647
commit 7ac88211f7
4 changed files with 14 additions and 9 deletions

View File

@ -10,8 +10,7 @@ module.exports = function(RED) {
if(config.cred){
let c = RED.nodes.getNode(config.cred)
this.admin = c.admin
let global = this.context().global
this.storage = c.storage || global.get('cloud-storage')
this.config = c;
this.bucket = config.bucket || c.bucket
this.path = config.path
}
@ -20,6 +19,8 @@ module.exports = function(RED) {
//console.log('configuring storage-list to listen for messages')
node.on('input', function(msg) {
if(msg && msg.payload){
let global = this.context().global
this.storage = this.config.storage || global.get('cloud-storage')
let path = msg.payload.path || this.path
let bucket = msg.payload.bucket || this.bucket
console.log('storage-list listing files from bucket "'+bucket+'" path "'+path+'"')