diff --git a/nodes/zammad-config.js b/nodes/zammad-config.js index e8195c6..3e54b8c 100644 --- a/nodes/zammad-config.js +++ b/nodes/zammad-config.js @@ -10,9 +10,9 @@ module.exports = function (RED) { node.baseUrl = (config.baseUrl || "https://example.com/api/v1").replace(/\/+$/, ""); node.useToken = config.useToken !== false; - node.token = config.token || ""; - node.username = config.username || ""; - node.password = config.password || ""; + node.token = (this.credentials && this.credentials.token) || config.token || ""; + node.username = (this.credentials && this.credentials.username) || config.username || ""; + node.password = (this.credentials && this.credentials.password) || config.password || ""; node.sendRequest = function (method, path, body, msgHeaders, callback) { const url = new URL(node.baseUrl + path); @@ -55,5 +55,11 @@ module.exports = function (RED) { }; } - RED.nodes.registerType("zammad-config", ZammadConfigNode); + RED.nodes.registerType("zammad-config", ZammadConfigNode, { + credentials: { + token: { type: "text" }, + username: { type: "text" }, + password: { type: "password" } + } + }); };