Make it possible to load only specific nodes

This commit is contained in:
Jan Oberhauser
2020-12-01 10:53:43 +01:00
parent f79cb7e989
commit ea79e80c17
2 changed files with 30 additions and 0 deletions

View File

@@ -413,6 +413,30 @@ const config = convict({
},
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: {
doc: 'Nodes not to load',
format: function check(rawValue) {