mirror of
https://github.com/Abdulazizzn/n8n-enterprise-unlocked.git
synced 2025-12-20 11:22:15 +00:00
✨ Make it possible to load only specific nodes
This commit is contained in:
@@ -413,6 +413,30 @@ const config = convict({
|
|||||||
},
|
},
|
||||||
|
|
||||||
nodes: {
|
nodes: {
|
||||||
|
include: {
|
||||||
|
doc: 'Nodes to load',
|
||||||
|
format: function check(rawValue) {
|
||||||
|
if (rawValue === '') {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
try {
|
||||||
|
const values = JSON.parse(rawValue);
|
||||||
|
if (!Array.isArray(values)) {
|
||||||
|
throw new Error();
|
||||||
|
}
|
||||||
|
|
||||||
|
for (const value of values) {
|
||||||
|
if (typeof value !== 'string') {
|
||||||
|
throw new Error();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
} catch (error) {
|
||||||
|
throw new TypeError(`The Nodes to include is not a valid Array of strings.`);
|
||||||
|
}
|
||||||
|
},
|
||||||
|
default: undefined,
|
||||||
|
env: 'NODES_INCLUDE',
|
||||||
|
},
|
||||||
exclude: {
|
exclude: {
|
||||||
doc: 'Nodes not to load',
|
doc: 'Nodes not to load',
|
||||||
format: function check(rawValue) {
|
format: function check(rawValue) {
|
||||||
|
|||||||
@@ -33,6 +33,7 @@ class LoadNodesAndCredentialsClass {
|
|||||||
} = {};
|
} = {};
|
||||||
|
|
||||||
excludeNodes: string[] | undefined = undefined;
|
excludeNodes: string[] | undefined = undefined;
|
||||||
|
includeNodes: string[] | undefined = undefined;
|
||||||
|
|
||||||
nodeModulesPath = '';
|
nodeModulesPath = '';
|
||||||
|
|
||||||
@@ -63,6 +64,7 @@ class LoadNodesAndCredentialsClass {
|
|||||||
}
|
}
|
||||||
|
|
||||||
this.excludeNodes = config.get('nodes.exclude');
|
this.excludeNodes = config.get('nodes.exclude');
|
||||||
|
this.includeNodes = config.get('nodes.include');
|
||||||
|
|
||||||
// Get all the installed packages which contain n8n nodes
|
// Get all the installed packages which contain n8n nodes
|
||||||
const packages = await this.getN8nNodePackages();
|
const packages = await this.getN8nNodePackages();
|
||||||
@@ -175,6 +177,10 @@ class LoadNodesAndCredentialsClass {
|
|||||||
tempNode.description.icon = 'file:' + path.join(path.dirname(filePath), tempNode.description.icon.substr(5));
|
tempNode.description.icon = 'file:' + path.join(path.dirname(filePath), tempNode.description.icon.substr(5));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (this.includeNodes !== undefined && !this.includeNodes.includes(fullNodeName)) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
// Check if the node should be skiped
|
// Check if the node should be skiped
|
||||||
if (this.excludeNodes !== undefined && this.excludeNodes.includes(fullNodeName)) {
|
if (this.excludeNodes !== undefined && this.excludeNodes.includes(fullNodeName)) {
|
||||||
return;
|
return;
|
||||||
|
|||||||
Reference in New Issue
Block a user