Moved settings.js to ts.

This commit is contained in:
SamTV12345 2024-02-21 21:48:51 +01:00
parent 71c74bc633
commit fbf8667019
44 changed files with 852 additions and 760 deletions

View file

@ -28,11 +28,10 @@ import {PluginType} from "./types/Plugin";
import {ErrorCaused} from "./types/ErrorCaused";
import log4js from 'log4js';
import {dumpOnUncleanExit} from './utils/Settings';
import * as settings from './utils/Settings';
import {settings} from './utils/Settings';
let wtfnode: any;
if (dumpOnUncleanExit) {
if (settings.dumpOnUncleanExit) {
// wtfnode should be loaded after log4js.replaceConsole() so that it uses log4js for logging, and
// it should be above everything else so that it can hook in before resources are used.
wtfnode = require('wtfnode');
@ -266,7 +265,7 @@ exports.exit = async (err: ErrorCaused|string|null = null) => {
logger.error('Something that should have been cleaned up during the shutdown hook (such as ' +
'a timer, worker thread, or open connection) is preventing Node.js from exiting');
if (dumpOnUncleanExit) {
if (settings.dumpOnUncleanExit) {
wtfnode.dump();
} else {
logger.error('Enable `dumpOnUncleanExit` setting to get a dump of objects preventing a ' +