From c7e6f3ae83ccac50223b14f40a87518553ff5565 Mon Sep 17 00:00:00 2001 From: John Morahan Date: Wed, 23 Jul 2025 10:19:12 +0100 Subject: [PATCH 1/3] feat: allow loading nodes from env-specified paths --- packages/server/src/NodesPool.ts | 14 +++++++++++--- 1 file changed, 11 insertions(+), 3 deletions(-) diff --git a/packages/server/src/NodesPool.ts b/packages/server/src/NodesPool.ts index 0ec14b86ffa..67fa41073ab 100644 --- a/packages/server/src/NodesPool.ts +++ b/packages/server/src/NodesPool.ts @@ -20,13 +20,21 @@ export class NodesPool { await this.initializeCredentials() } + private initializeNodes() { + const mainPath = path.join(getNodeModulesPackagePath('flowise-components'), 'dist', 'nodes') + const additionalPaths = process.env.COMPONENTS_PATH?.split(':') ?? [] + return Promise.all( + [mainPath, ...additionalPaths] + .filter((nodesPath) => nodesPath !== '') // specify '.' if you really want + .map(this.initializeNodesFromPath.bind(this)) + ) + } + /** * Initialize nodes */ - private async initializeNodes() { + private async initializeNodesFromPath(nodesPath: string) { const disabled_nodes = process.env.DISABLED_NODES ? process.env.DISABLED_NODES.split(',') : [] - const packagePath = getNodeModulesPackagePath('flowise-components') - const nodesPath = path.join(packagePath, 'dist', 'nodes') const nodeFiles = await this.getFiles(nodesPath) return Promise.all( nodeFiles.map(async (file) => { From 794553e7c99f315559c6281a7a61a99a660bb2e3 Mon Sep 17 00:00:00 2001 From: John Morahan Date: Mon, 28 Jul 2025 14:44:48 +0100 Subject: [PATCH 2/3] fix: use correct cross platform path delimiter --- packages/server/src/NodesPool.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/packages/server/src/NodesPool.ts b/packages/server/src/NodesPool.ts index 67fa41073ab..09d27a8d132 100644 --- a/packages/server/src/NodesPool.ts +++ b/packages/server/src/NodesPool.ts @@ -22,7 +22,7 @@ export class NodesPool { private initializeNodes() { const mainPath = path.join(getNodeModulesPackagePath('flowise-components'), 'dist', 'nodes') - const additionalPaths = process.env.COMPONENTS_PATH?.split(':') ?? [] + const additionalPaths = process.env.COMPONENTS_PATH?.split(path.delimiter) ?? [] return Promise.all( [mainPath, ...additionalPaths] .filter((nodesPath) => nodesPath !== '') // specify '.' if you really want From 25a0e2ab2c5c4158652bddd84e96bd50b31679e7 Mon Sep 17 00:00:00 2001 From: toi500 <138339291+toi500@users.noreply.github.com> Date: Mon, 28 Jul 2025 17:25:07 +0200 Subject: [PATCH 3/3] feat: ensure custom nodes override default ones --- packages/server/src/NodesPool.ts | 14 ++++++++------ 1 file changed, 8 insertions(+), 6 deletions(-) diff --git a/packages/server/src/NodesPool.ts b/packages/server/src/NodesPool.ts index 09d27a8d132..6a730b43715 100644 --- a/packages/server/src/NodesPool.ts +++ b/packages/server/src/NodesPool.ts @@ -20,14 +20,16 @@ export class NodesPool { await this.initializeCredentials() } - private initializeNodes() { + private async initializeNodes() { const mainPath = path.join(getNodeModulesPackagePath('flowise-components'), 'dist', 'nodes') const additionalPaths = process.env.COMPONENTS_PATH?.split(path.delimiter) ?? [] - return Promise.all( - [mainPath, ...additionalPaths] - .filter((nodesPath) => nodesPath !== '') // specify '.' if you really want - .map(this.initializeNodesFromPath.bind(this)) - ) + + // Load sequentially to ensure custom nodes override default ones + for (const nodesPath of [mainPath, ...additionalPaths]) { + if (nodesPath !== '') { + await this.initializeNodesFromPath(nodesPath) + } + } } /**