mirror of
https://github.com/Abdulazizzn/n8n-enterprise-unlocked.git
synced 2025-12-17 18:12:04 +00:00
fix: Make nodes.exclude and nodes.include work with lazy-loaded nodes (#4833)
This commit is contained in:
committed by
GitHub
parent
a09ff27f43
commit
85241fd230
@@ -1,8 +1,32 @@
|
||||
/* eslint-disable no-restricted-syntax */
|
||||
/* eslint-disable @typescript-eslint/no-unsafe-assignment */
|
||||
|
||||
import path from 'path';
|
||||
import * as core from 'n8n-core';
|
||||
import convict from 'convict';
|
||||
import { UserSettings } from 'n8n-core';
|
||||
import { jsonParse } from 'n8n-workflow';
|
||||
|
||||
convict.addFormat({
|
||||
name: 'nodes-list',
|
||||
// @ts-ignore
|
||||
validate(values: string[], { env }: { env: string }): void {
|
||||
try {
|
||||
if (!Array.isArray(values)) {
|
||||
throw new Error();
|
||||
}
|
||||
|
||||
for (const value of values) {
|
||||
if (typeof value !== 'string') {
|
||||
throw new Error();
|
||||
}
|
||||
}
|
||||
} catch (error) {
|
||||
throw new TypeError(`${env} is not a valid Array of strings.`);
|
||||
}
|
||||
},
|
||||
coerce(rawValue: string): string[] {
|
||||
return jsonParse(rawValue, { errorMessage: 'nodes-list needs to be valid JSON' });
|
||||
},
|
||||
});
|
||||
|
||||
export const schema = {
|
||||
database: {
|
||||
@@ -716,47 +740,14 @@ export const schema = {
|
||||
nodes: {
|
||||
include: {
|
||||
doc: 'Nodes to load',
|
||||
format: function check(rawValue: string): void {
|
||||
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.`);
|
||||
}
|
||||
},
|
||||
format: 'nodes-list',
|
||||
default: undefined,
|
||||
env: 'NODES_INCLUDE',
|
||||
},
|
||||
exclude: {
|
||||
doc: 'Nodes not to load',
|
||||
format: function check(rawValue: string): void {
|
||||
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 exclude is not a valid Array of strings.`);
|
||||
}
|
||||
},
|
||||
default: '[]',
|
||||
format: 'nodes-list',
|
||||
default: undefined,
|
||||
env: 'NODES_EXCLUDE',
|
||||
},
|
||||
errorTriggerType: {
|
||||
@@ -804,7 +795,7 @@ export const schema = {
|
||||
location: {
|
||||
doc: 'Log file location; only used if log output is set to file.',
|
||||
format: String,
|
||||
default: path.join(core.UserSettings.getUserN8nFolderPath(), 'logs/n8n.log'),
|
||||
default: path.join(UserSettings.getUserN8nFolderPath(), 'logs/n8n.log'),
|
||||
env: 'N8N_LOG_FILE_LOCATION',
|
||||
},
|
||||
},
|
||||
@@ -861,7 +852,7 @@ export const schema = {
|
||||
},
|
||||
localStoragePath: {
|
||||
format: String,
|
||||
default: path.join(core.UserSettings.getUserN8nFolderPath(), 'binaryData'),
|
||||
default: path.join(UserSettings.getUserN8nFolderPath(), 'binaryData'),
|
||||
env: 'N8N_BINARY_DATA_STORAGE_PATH',
|
||||
doc: 'Path for binary data storage in "filesystem" mode',
|
||||
},
|
||||
|
||||
Reference in New Issue
Block a user