Update diagnostics as per Issue discussion

This commit is contained in:
Steve-Mcl
2022-03-29 20:48:29 +01:00
parent cf6df1556c
commit 03763a1423
3 changed files with 66 additions and 64 deletions

View File

@@ -69,19 +69,17 @@ function buildDiagnosticReport(scope, callback) {
}
const now = new Date();
const {locale, timeZone} = Intl.DateTimeFormat().resolvedOptions();
const report = {
report: "diagnostics",
scope: scope,
version: runtime.settings.version,
isStarted: runtime.isStarted(),
containerised: isInContainer(),
wsl: isInWsl(),
time: {
timestamp: now.valueOf(),
utc: "" + now.toUTCString(),
locale: now.toLocaleString(),
utc: now.toUTCString(),
local: now.toLocaleString(),
},
intl: {
locale, timeZone
},
intl: Intl.DateTimeFormat().resolvedOptions(),
nodejs: {
version: process.version,
arch: process.arch,
@@ -89,6 +87,8 @@ function buildDiagnosticReport(scope, callback) {
memoryUsage: process.memoryUsage(),
},
os: {
containerised: isInContainer(),
wsl: isInWsl(),
totalmem: os.totalmem(),
freemem: os.freemem(),
arch: os.arch(),
@@ -100,67 +100,69 @@ function buildDiagnosticReport(scope, callback) {
version: os.version(),
},
runtime: {
isStarted: runtime.isStarted(),
modules: modules,
version: runtime.settings.version,
settings: {
available: runtime.settings.available(),
apiMaxLength: runtime.settings.apiMaxLength || "NO SETTING",
apiMaxLength: runtime.settings.apiMaxLength || "UNSET",
//coreNodesDir: runtime.settings.coreNodesDir,
disableEditor: runtime.settings.disableEditor,
contextStorage: listContextModules(),
debugMaxLength: runtime.settings.debugMaxLength || "NO SETTING",
editorTheme: runtime.settings.editorTheme || "NO SETTING",
flowFile: runtime.settings.flowFile || "NO SETTING",
mqttReconnectTime: runtime.settings.mqttReconnectTime || "NO SETTING",
serialReconnectTime: runtime.settings.serialReconnectTime || "NO SETTING",
debugMaxLength: runtime.settings.debugMaxLength || "UNSET",
editorTheme: runtime.settings.editorTheme || "UNSET",
flowFile: runtime.settings.flowFile || "UNSET",
mqttReconnectTime: runtime.settings.mqttReconnectTime || "UNSET",
serialReconnectTime: runtime.settings.serialReconnectTime || "UNSET",
adminAuth: runtime.settings.adminAuth ? "HAS SETTING" : "NO SETTING",
adminAuth: runtime.settings.adminAuth ? "SET" : "UNSET",
httpAdminRoot: runtime.settings.adminAuth ? "HAS SETTING" : "NO SETTING",
httpAdminCors: runtime.settings.httpAdminCors ? "HAS SETTING" : "NO SETTING",
httpNodeAuth: runtime.settings.httpNodeAuth ? "HAS SETTING" : "NO SETTING",
httpAdminRoot: runtime.settings.adminAuth ? "SET" : "UNSET",
httpAdminCors: runtime.settings.httpAdminCors ? "SET" : "UNSET",
httpNodeAuth: runtime.settings.httpNodeAuth ? "SET" : "UNSET",
httpAdminRoot: runtime.settings.httpAdminRoot || "NO SETTING",
httpAdminCors: runtime.settings.httpAdminCors ? "HAS SETTING" : "NO SETTING",
httpAdminRoot: runtime.settings.httpAdminRoot || "UNSET",
httpAdminCors: runtime.settings.httpAdminCors ? "SET" : "UNSET",
httpNodeRoot: runtime.settings.httpNodeRoot || "NO SETTING",
httpNodeCors: runtime.settings.httpNodeCors ? "HAS SETTING" : "NO SETTING",
httpNodeRoot: runtime.settings.httpNodeRoot || "UNSET",
httpNodeCors: runtime.settings.httpNodeCors ? "SET" : "UNSET",
httpStatic: runtime.settings.httpStatic ? "HAS SETTING" : "NO SETTING",
httpStatic: runtime.settings.httpStaticRoot || "NO SETTING",
httpStaticCors: runtime.settings.httpStaticCors ? "HAS SETTING" : "NO SETTING",
httpStatic: runtime.settings.httpStatic ? "SET" : "UNSET",
httpStatic: runtime.settings.httpStaticRoot || "UNSET",
httpStaticCors: runtime.settings.httpStaticCors ? "SET" : "UNSET",
uiHost: runtime.settings.uiHost ? "HAS SETTING" : "NO SETTING",
uiPort: runtime.settings.uiPort ? "HAS SETTING" : "NO SETTING",
userDir: runtime.settings.userDir ? "HAS SETTING" : "NO SETTING",
uiHost: runtime.settings.uiHost ? "SET" : "UNSET",
uiPort: runtime.settings.uiPort ? "SET" : "UNSET",
userDir: runtime.settings.userDir ? "SET" : "UNSET",
}
}
}
if (scope == "admin") {
const moreSettings = {
adminAuth_type: (runtime.settings.adminAuth && runtime.settings.adminAuth.type) ? runtime.settings.adminAuth.type : "NO SETTING",
httpAdminCors: runtime.settings.httpAdminCors ? runtime.settings.httpAdminCors : "NO SETTING",
httpNodeCors: runtime.settings.httpNodeCors ? runtime.settings.httpNodeCors : "NO SETTING",
httpStaticCors: runtime.settings.httpStaticCors ? "HAS SETTING" : "NO SETTING",
settingsFile: runtime.settings.settingsFile ? runtime.settings.settingsFile : "NO SETTING",
uiHost: runtime.settings.uiHost ? runtime.settings.uiHost : "NO SETTING",
uiPort: runtime.settings.uiPort ? runtime.settings.uiPort : "NO SETTING",
userDir: runtime.settings.userDir ? runtime.settings.userDir : "NO SETTING",
}
const moreNodejs = {
execPath: process.execPath,
pid: process.pid,
}
const moreOs = {
cpus: os.cpus(),
homedir: os.homedir(),
hostname: os.hostname(),
networkInterfaces: os.networkInterfaces(),
}
report.runtime.settings = Object.assign({}, report.runtime.settings, moreSettings);
report.nodejs = Object.assign({}, report.nodejs, moreNodejs);
report.os = Object.assign({}, report.os, moreOs);
}
// if (scope == "admin") {
// const moreSettings = {
// adminAuth_type: (runtime.settings.adminAuth && runtime.settings.adminAuth.type) ? runtime.settings.adminAuth.type : "UNSET",
// httpAdminCors: runtime.settings.httpAdminCors ? runtime.settings.httpAdminCors : "UNSET",
// httpNodeCors: runtime.settings.httpNodeCors ? runtime.settings.httpNodeCors : "UNSET",
// httpStaticCors: runtime.settings.httpStaticCors ? "SET" : "UNSET",
// settingsFile: runtime.settings.settingsFile ? runtime.settings.settingsFile : "UNSET",
// uiHost: runtime.settings.uiHost ? runtime.settings.uiHost : "UNSET",
// uiPort: runtime.settings.uiPort ? runtime.settings.uiPort : "UNSET",
// userDir: runtime.settings.userDir ? runtime.settings.userDir : "UNSET",
// }
// const moreNodejs = {
// execPath: process.execPath,
// pid: process.pid,
// }
// const moreOs = {
// cpus: os.cpus(),
// homedir: os.homedir(),
// hostname: os.hostname(),
// networkInterfaces: os.networkInterfaces(),
// }
// report.runtime.settings = Object.assign({}, report.runtime.settings, moreSettings);
// report.nodejs = Object.assign({}, report.nodejs, moreNodejs);
// report.os = Object.assign({}, report.os, moreOs);
// }
callback(report);