X-Git-Url: https://git.piment-noir.org/?a=blobdiff_plain;f=src%2Fcharging-station%2FAuthorizedTagsCache.ts;h=4f853a971fc537fe35f872fbeaf6f2075a50e830;hb=44eb6026079c8dc2c77b10a96a42d0c0b2da7c8f;hp=d39fbee61e6fa6e27a13fbddbab25dbdffee2d06;hpb=1ca780f9d385bcf96a016ab5ba57ca0f19c94b74;p=e-mobility-charging-stations-simulator.git diff --git a/src/charging-station/AuthorizedTagsCache.ts b/src/charging-station/AuthorizedTagsCache.ts index d39fbee6..4f853a97 100644 --- a/src/charging-station/AuthorizedTagsCache.ts +++ b/src/charging-station/AuthorizedTagsCache.ts @@ -23,10 +23,10 @@ export default class AuthorizedTagsCache { } public getAuthorizedTags(file: string): string[] { - if (!this.hasTags(file)) { + if (this.hasTags(file) === false) { this.setTags(file, this.getAuthorizedTagsFromFile(file)); // Monitor authorization file - !this.FSWatchers.has(file) && + this.FSWatchers.has(file) === false && this.FSWatchers.set( file, FileUtils.watchJsonFile( @@ -38,10 +38,7 @@ export default class AuthorizedTagsCache { if (filename && event === 'change') { try { logger.debug( - this.logPrefix(file) + - ' ' + - FileType.Authorization + - ' file have changed, reload' + `${this.logPrefix(file)} ${FileType.Authorization} file have changed, reload` ); this.deleteTags(file); this.deleteFSWatcher(file); @@ -64,6 +61,10 @@ export default class AuthorizedTagsCache { return this.getTags(file); } + public deleteAuthorizedTags(file: string): boolean { + return this.deleteTags(file); + } + private hasTags(file: string): boolean { return this.tagsCaches.has(file); } @@ -100,7 +101,7 @@ export default class AuthorizedTagsCache { ); } } else { - logger.info(this.logPrefix(file) + ' No authorization file given)'); + logger.info(`${this.logPrefix(file)} No authorization file given`); } return authorizedTags; }