import merge from 'just-merge';
import { WorkerChoiceStrategies } from 'poolifier';
+import Constants from './Constants';
import {
type ConfigurationData,
type StationTemplateUrl,
import { ApplicationProtocol } from '../types/UIProtocol';
import { WorkerProcessType } from '../types/Worker';
import WorkerConstants from '../worker/WorkerConstants';
-import Constants from './Constants';
export default class Configuration {
private static configurationFile = path.join(
},
};
if (Configuration.objectHasOwnProperty(Configuration.getConfig(), 'uiServer')) {
- uiServerConfiguration = Configuration.merge(
- uiServerConfiguration,
- Configuration.getConfig().uiServer
- );
+ uiServerConfiguration = merge(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 && '. ' + logMsgToAppend
+ logMsgToAppend && `. ${logMsgToAppend}`
}}`
);
} else if (!Configuration.isUndefined(Configuration.getConfig()[key])) {
console.error(
chalk`{green ${Configuration.logPrefix()}} {red Deprecated configuration key '${key}' usage${
- logMsgToAppend && '. ' + logMsgToAppend
+ logMsgToAppend && `. ${logMsgToAppend}`
}}`
);
}
}
private static getDefaultPerformanceStorageUri(storageType: StorageType) {
- const SQLiteFileName = `${Constants.DEFAULT_PERFORMANCE_RECORDS_DB_NAME}.db`;
switch (storageType) {
case StorageType.JSON_FILE:
return `file://${path.join(
case StorageType.SQLITE:
return `file://${path.join(
path.resolve(path.dirname(fileURLToPath(import.meta.url)), '../../'),
- SQLiteFileName
+ `${Constants.DEFAULT_PERFORMANCE_RECORDS_DB_NAME}.db`
)}`;
default:
throw new Error(`Performance storage URI is mandatory with storage type '${storageType}'`);
}
}
- // private static isObject(item: unknown): boolean {
- // return item && typeof item === 'object' && Array.isArray(item) === false;
- // }
-
private static objectHasOwnProperty(object: unknown, property: string): boolean {
return Object.prototype.hasOwnProperty.call(object, property) as boolean;
}
return typeof obj === 'undefined';
}
- private static merge(target: object, ...sources: object[]): object {
- return merge(target, ...sources);
- }
-
private static handleFileException(
logPrefix: string,
fileType: FileType,