import type { ChargingStation } from './ChargingStation';
import { ChargingStationUtils } from './ChargingStationUtils';
import { FileType, IdTagDistribution } from '../types';
-import { ErrorUtils, FileUtils, Utils, logger } from '../utils';
+import { Utils, handleFileException, logger, watchJsonFile } from '../utils';
type IdTagsCacheValueType = {
idTags: string[];
* Get one idtag from the cache given the distribution
* Must be called after checking the cache is not an empty array
*
- * @param distribution
- * @param chargingStation
- * @param connectorId
+ * @param distribution -
+ * @param chargingStation -
+ * @param connectorId -
* @returns
*/
public getIdTag(
* Get all idtags from the cache
* Must be called after checking the cache is not an empty array
*
- * @param file
+ * @param file -
* @returns
*/
public getIdTags(file: string): string[] | undefined {
private setIdTagsCache(file: string, idTags: string[]) {
return this.idTagsCaches.set(file, {
idTags,
- idTagsFileWatcher: FileUtils.watchJsonFile(
+ idTagsFileWatcher: watchJsonFile(
file,
FileType.Authorization,
this.logPrefix(file),
this.deleteIdTagsCache(file);
this.deleteIdTagsCacheIndexes(file);
} catch (error) {
- ErrorUtils.handleFileException(
+ handleFileException(
file,
FileType.Authorization,
error as NodeJS.ErrnoException,
try {
return JSON.parse(fs.readFileSync(file, 'utf8')) as string[];
} catch (error) {
- ErrorUtils.handleFileException(
+ handleFileException(
file,
FileType.Authorization,
error as NodeJS.ErrnoException,
);
}
}
- logger.info(`${this.logPrefix(file)} No id tags file given in configuration`);
return [];
}