import merge from 'just-merge';
import { WorkerChoiceStrategies } from 'poolifier';
-import Constants from './Constants';
+import { Constants } from './Constants';
import {
+ ApplicationProtocol,
type ConfigurationData,
+ type EmptyObject,
+ FileType,
+ type HandleErrorParams,
type StationTemplateUrl,
type StorageConfiguration,
+ StorageType,
SupervisionUrlDistribution,
type UIServerConfiguration,
type WorkerConfiguration,
-} from '../types/ConfigurationData';
-import type { EmptyObject } from '../types/EmptyObject';
-import type { HandleErrorParams } from '../types/Error';
-import { FileType } from '../types/FileType';
-import { StorageType } from '../types/Storage';
-import { ApplicationProtocol } from '../types/UIProtocol';
-import { WorkerProcessType } from '../types/Worker';
-import WorkerConstants from '../worker/WorkerConstants';
+} from '../types';
+import { WorkerConstants, WorkerProcessType } from '../worker';
-export default class Configuration {
+export class Configuration {
private static configurationFile = path.join(
path.resolve(path.dirname(fileURLToPath(import.meta.url)), '../'),
'assets',
},
};
if (Configuration.objectHasOwnProperty(Configuration.getConfig(), 'uiServer')) {
- uiServerConfiguration = merge(uiServerConfiguration, Configuration.getConfig()?.uiServer);
+ uiServerConfiguration = merge<UIServerConfiguration>(
+ uiServerConfiguration,
+ Configuration.getConfig()?.uiServer
+ );
}
if (Configuration.isCFEnvironment() === true) {
delete uiServerConfiguration.options?.host;
) {
console.error(
chalk`{green ${Configuration.logPrefix()}} {red Deprecated configuration key '${key}' usage in section '${sectionName}'${
- logMsgToAppend.trim().length !== 0 && `. ${logMsgToAppend}`
+ logMsgToAppend.trim().length > 0 && `. ${logMsgToAppend}`
}}`
);
} else if (!Configuration.isUndefined(Configuration.getConfig()[key])) {
console.error(
chalk`{green ${Configuration.logPrefix()}} {red Deprecated configuration key '${key}' usage${
- logMsgToAppend.trim().length !== 0 && `. ${logMsgToAppend}`
+ logMsgToAppend.trim().length > 0 && `. ${logMsgToAppend}`
}}`
);
}
private static getConfigurationFileWatcher(): fs.FSWatcher | undefined {
try {
return fs.watch(Configuration.configurationFile, (event, filename): void => {
- if (filename.trim().length !== 0 && event === 'change') {
+ if (filename?.trim().length > 0 && event === 'change') {
// Nullify to force configuration file reading
Configuration.configuration = null;
if (!Configuration.isUndefined(Configuration.configurationChangeCallback)) {
logPrefix: string,
params: HandleErrorParams<EmptyObject> = { throwError: true }
): void {
- const prefix = logPrefix.trim().length !== 0 ? `${logPrefix} ` : '';
+ const prefix = logPrefix?.trim().length > 0 ? `${logPrefix} ` : '';
let logMsg: string;
switch (error.code) {
case 'ENOENT':