Rename vars NODE_RED -> NODERED; Disconnect hooks after Node is closed#92
Rename vars NODE_RED -> NODERED; Disconnect hooks after Node is closed#92moellenbeck merged 2 commits intomainfrom
Conversation
There was a problem hiding this comment.
Pull Request Overview
This PR renames environment variables from NODE_RED_* to NODERED_* while maintaining backward compatibility, and fixes a memory leak by properly removing event hooks when the external task node is closed.
Key Changes:
- Adds support for new
NODERED_*environment variable naming convention alongside existingNODE_RED_*variables - Implements proper cleanup of
preDeliverandpostDeliverhooks in the node's close handler - Updates Node-RED version from 4.0.8 to 4.1.1
Reviewed Changes
Copilot reviewed 6 out of 6 changed files in this pull request and generated 3 comments.
Show a summary per file
| File | Description |
|---|---|
| package.json | Version bump to 1.16.1 |
| externaltask-input.js | Adds NODERED_* env var support, extracts hook callbacks to named functions, and removes hooks on node close |
| Dockerfile | Updates base image to Node-RED 4.1.1-22 |
| .processcube/nodered/.config.users.json | Updates config for Node-RED 4.1.1 with new view settings |
| .processcube/nodered/.config.runtime.json | Adds telemetry disabled flag |
| .processcube/nodered/.config.nodes.json | Updates version references to 4.1.1 and 1.16.1 |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
externaltask-input.js
Outdated
| if (!options['lockDuration'] && (process.env.NODE_RED_ETW_LOCK_DURATION || process.env.NODERED_ETW_LOCK_DURATION)) { | ||
| options['lockDuration'] = parseInt(process.env.NODE_RED_ETW_LOCK_DURATION) || parseInt(process.env.NODERED_ETW_LOCK_DURATION) || undefined; |
There was a problem hiding this comment.
The condition checks for the existence of either environment variable, but the assignment attempts to parse both even when only one exists. Consider using a more efficient approach that avoids unnecessary parseInt calls: options['lockDuration'] = parseInt(process.env.NODE_RED_ETW_LOCK_DURATION || process.env.NODERED_ETW_LOCK_DURATION) || undefined;
externaltask-input.js
Outdated
|
|
||
| if (!options['longpollingTimeout']) { | ||
| options['longpollingTimeout'] = parseInt(process.env.NODE_RED_ETW_LONGPOLLING_TIMEOUT) || undefined; | ||
| options['longpollingTimeout'] = parseInt(process.env.NODE_RED_ETW_LONGPOLLING_TIMEOUT) || parseInt(process.env.NODERED_ETW_LONGPOLLING_TIMEOUT) || undefined; |
There was a problem hiding this comment.
The code unnecessarily calls parseInt twice. Use a single parseInt call with the OR operator inside: parseInt(process.env.NODE_RED_ETW_LONGPOLLING_TIMEOUT || process.env.NODERED_ETW_LONGPOLLING_TIMEOUT) || undefined
| options['longpollingTimeout'] = parseInt(process.env.NODE_RED_ETW_LONGPOLLING_TIMEOUT) || parseInt(process.env.NODERED_ETW_LONGPOLLING_TIMEOUT) || undefined; | |
| options['longpollingTimeout'] = parseInt(process.env.NODE_RED_ETW_LONGPOLLING_TIMEOUT || process.env.NODERED_ETW_LONGPOLLING_TIMEOUT) || undefined; |
externaltask-input.js
Outdated
|
|
||
| if (!options['idleTimeout']) { | ||
| options['idleTimeout'] = parseInt(process.env.NODE_RED_ETW_IDLE_TIMEOUT) || undefined; | ||
| options['idleTimeout'] = parseInt(process.env.NODE_RED_ETW_IDLE_TIMEOUT) || parseInt(process.env.NODERED_ETW_IDLE_TIMEOUT) || undefined; |
There was a problem hiding this comment.
The code unnecessarily calls parseInt twice. Use a single parseInt call with the OR operator inside: parseInt(process.env.NODE_RED_ETW_IDLE_TIMEOUT || process.env.NODERED_ETW_IDLE_TIMEOUT) || undefined
| options['idleTimeout'] = parseInt(process.env.NODE_RED_ETW_IDLE_TIMEOUT) || parseInt(process.env.NODERED_ETW_IDLE_TIMEOUT) || undefined; | |
| options['idleTimeout'] = parseInt(process.env.NODE_RED_ETW_IDLE_TIMEOUT || process.env.NODERED_ETW_IDLE_TIMEOUT) || undefined; |
There was a problem hiding this comment.
Pull Request Overview
Copilot reviewed 6 out of 6 changed files in this pull request and generated 3 comments.
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
| if (!options['lockDuration'] && (process.env.NODE_RED_ETW_LOCK_DURATION || process.env.NODERED_ETW_LOCK_DURATION)) { | ||
| options['lockDuration'] = parseInt(process.env.NODE_RED_ETW_LOCK_DURATION || process.env.NODERED_ETW_LOCK_DURATION) || undefined; |
There was a problem hiding this comment.
The environment variable check is duplicated. Store process.env.NODE_RED_ETW_LOCK_DURATION || process.env.NODERED_ETW_LOCK_DURATION in a constant to avoid repeating the logic and improve maintainability.
| if (!options['lockDuration'] && (process.env.NODE_RED_ETW_LOCK_DURATION || process.env.NODERED_ETW_LOCK_DURATION)) { | |
| options['lockDuration'] = parseInt(process.env.NODE_RED_ETW_LOCK_DURATION || process.env.NODERED_ETW_LOCK_DURATION) || undefined; | |
| const LOCK_DURATION_ENV = process.env.NODE_RED_ETW_LOCK_DURATION || process.env.NODERED_ETW_LOCK_DURATION; | |
| if (!options['lockDuration'] && LOCK_DURATION_ENV) { | |
| options['lockDuration'] = parseInt(LOCK_DURATION_ENV) || undefined; |
|
|
||
| if (!options['longpollingTimeout']) { | ||
| options['longpollingTimeout'] = parseInt(process.env.NODE_RED_ETW_LONGPOLLING_TIMEOUT) || undefined; | ||
| options['longpollingTimeout'] = parseInt(process.env.NODE_RED_ETW_LONGPOLLING_TIMEOUT || process.env.NODERED_ETW_LONGPOLLING_TIMEOUT) || undefined; |
There was a problem hiding this comment.
The environment variable check is duplicated. Store process.env.NODE_RED_ETW_LONGPOLLING_TIMEOUT || process.env.NODERED_ETW_LONGPOLLING_TIMEOUT in a constant to avoid repeating the logic and improve maintainability.
|
|
||
| if (!options['idleTimeout']) { | ||
| options['idleTimeout'] = parseInt(process.env.NODE_RED_ETW_IDLE_TIMEOUT) || undefined; | ||
| options['idleTimeout'] = parseInt(process.env.NODE_RED_ETW_IDLE_TIMEOUT || process.env.NODERED_ETW_IDLE_TIMEOUT) || undefined; |
There was a problem hiding this comment.
The environment variable check is duplicated. Store process.env.NODE_RED_ETW_IDLE_TIMEOUT || process.env.NODERED_ETW_IDLE_TIMEOUT in a constant to avoid repeating the logic and improve maintainability.
# Changelog v1.16.1 (27.10.2025) Dieser Changelog deckt die Änderungen zwischen folgenden Versionen ab: [v1.16.0 und v1.16.1](v1.16.0...v1.16.1). Weitere Hinweise befinden sich im Changelog der vorherigen Version: [v1.16.0](https://github.com/5minds/node-red-contrib-processcube/releases/tag/v1.16.0). ## Merged Pull Requests - #92 Rename vars NODE_RED -> NODERED; Disconnect hooks after Node is closed (merged 27.10.2025) [skip ci]
Pull Request Overview
This PR renames environment variables from
NODE_RED_*toNODERED_*while maintaining backward compatibility, and fixes a memory leak by properly removing event hooks when the external task node is closed.Key Changes:
NODERED_*environment variable naming convention alongside existingNODE_RED_*variablespreDeliverandpostDeliverhooks in the node's close handlerReviewed Changes
Copilot reviewed 6 out of 6 changed files in this pull request and generated 3 comments.
Show a summary per file
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.