+
+ private static getConfigurationFileWatcher(): fs.FSWatcher {
+ try {
+ // eslint-disable-next-line @typescript-eslint/no-misused-promises
+ return fs.watch(Configuration.configurationFilePath).on('change', async (e): Promise<void> => {
+ // Nullify to force configuration file reading
+ Configuration.configuration = null;
+ if (!Configuration.isUndefined(Configuration.configurationChangeCallback)) {
+ await Configuration.configurationChangeCallback();
+ }
+ });
+ } catch (error) {
+ Configuration.handleFileException(Configuration.logPrefix(), 'Configuration', Configuration.configurationFilePath, error);
+ }
+ }
+
+ private static objectHasOwnProperty(object: any, property: string): boolean {
+ return Object.prototype.hasOwnProperty.call(object, property) as boolean;
+ }
+
+ private static isUndefined(obj: any): boolean {
+ return typeof obj === 'undefined';
+ }
+
+ private static handleFileException(logPrefix: string, fileType: string, filePath: string, error: NodeJS.ErrnoException): void {
+ const prefix = logPrefix.length !== 0 ? logPrefix + ' ' : '';
+ if (error.code === 'ENOENT') {
+ console.error(prefix + fileType + ' file ' + filePath + ' not found: ', error);
+ } else {
+ console.error(prefix + fileType + ' file ' + filePath + ' opening error: ', error);
+ }
+ throw error;
+ }