diff --git a/package.json b/package.json index e28de5c..631f36b 100644 --- a/package.json +++ b/package.json @@ -4,6 +4,7 @@ "description": "", "scripts": { "dev": "nodemon", + "debug": "node --inspect-brk=0.0.0.0:9229 --require ts-node/register src/app.ts", "build": "shx rm -rf ./dist/ && tsc && shx cp -r openapi dist/openapi", "build:clients": "bash scripts/build-clients.sh", "start": "node dist/app.js", diff --git a/src/config/config.json b/src/config/config.json index 06cf14f..a158d10 100644 --- a/src/config/config.json +++ b/src/config/config.json @@ -19,6 +19,6 @@ "NUMBER_OF_NODE_REQUEST_CHUNK": 10, "NODE_PEERS_REQUEST_CHUNK_SIZE": 50, "CHAIN_HEIGHT_REQUEST_CHUNK_SIZE": 10, - "PREFERRED_NODES": ["*.symboldev.network"], + "PREFERRED_NODES": [], "MIN_PARTNER_NODE_VERSION": 16777728 } diff --git a/src/config/index.ts b/src/config/index.ts index 013dd4d..c109bc6 100644 --- a/src/config/index.ts +++ b/src/config/index.ts @@ -81,8 +81,6 @@ export const verifyConfig = (cfg: Config): boolean => { error = 'Invalid "NODES"'; } - if (cfg.symbol.PREFERRED_NODES.length === 0) error = 'Invalid "PREFERRED NODES"'; - if (isNaN(cfg.monitor.NODE_MONITOR_SCHEDULE_INTERVAL) || cfg.monitor.NODE_MONITOR_SCHEDULE_INTERVAL < 0) error = 'Invalid "NODE_MONITOR_SCHEDULE_INTERVAL"'; diff --git a/src/routes/index.ts b/src/routes/index.ts index 33b5153..e4bc767 100644 --- a/src/routes/index.ts +++ b/src/routes/index.ts @@ -37,10 +37,13 @@ export class Routes { } // ?filter=preferred - // it filter by host / domain name config by admin. + // it filters by host / domain name config by admin. if (filter === NodeFilter.Preferred) { + if (!symbol.PREFERRED_NODES?.length) { + return Promise.resolve(res.send([])); + } Object.assign(searchCriteria.filter, { - host: { $in: symbol.PREFERRED_NODES.map((node) => new RegExp(`^.${node}`, 'i')) }, + host: { $in: symbol.PREFERRED_NODES.map((node) => new RegExp(`^${node}`, 'i')) }, 'apiStatus.isAvailable': true, 'apiStatus.nodeStatus.apiNode': 'up', 'apiStatus.nodeStatus.db': 'up',