From 53b8a4fd3c9b2612ddecf5d7abd0715bbab94c64 Mon Sep 17 00:00:00 2001 From: =?utf8?q?J=C3=A9r=C3=B4me=20Benoit?= Date: Sat, 1 Jul 2023 14:10:29 +0200 Subject: [PATCH] refactor: use a directory to store performance related files MIME-Version: 1.0 Content-Type: text/plain; charset=utf8 Content-Transfer-Encoding: 8bit Signed-off-by: Jérôme Benoit --- .gitignore | 1 + src/utils/Configuration.ts | 4 ++-- src/utils/Constants.ts | 1 + 3 files changed, 4 insertions(+), 2 deletions(-) diff --git a/.gitignore b/.gitignore index 5bf56abf..197aeb76 100644 --- a/.gitignore +++ b/.gitignore @@ -117,6 +117,7 @@ package-lock.json .eslintcache temp/ *.tar.gz +performance/ performanceRecords.json performanceRecords.json.lock *.db diff --git a/src/utils/Configuration.ts b/src/utils/Configuration.ts index b54f3900..3e3adbc2 100644 --- a/src/utils/Configuration.ts +++ b/src/utils/Configuration.ts @@ -476,11 +476,11 @@ export class Configuration { switch (storageType) { case StorageType.JSON_FILE: return Configuration.buildPerformanceUriFilePath( - Constants.DEFAULT_PERFORMANCE_RECORDS_FILENAME + `${Constants.DEFAULT_PERFORMANCE_DIRECTORY}/${Constants.DEFAULT_PERFORMANCE_RECORDS_FILENAME}` ); case StorageType.SQLITE: return Configuration.buildPerformanceUriFilePath( - `${Constants.DEFAULT_PERFORMANCE_RECORDS_DB_NAME}.db` + `${Constants.DEFAULT_PERFORMANCE_DIRECTORY}/${Constants.DEFAULT_PERFORMANCE_RECORDS_DB_NAME}.db` ); default: throw new Error(`Performance storage URI is mandatory with storage type '${storageType}'`); diff --git a/src/utils/Constants.ts b/src/utils/Constants.ts index 30327b6a..c4ce0ff8 100644 --- a/src/utils/Constants.ts +++ b/src/utils/Constants.ts @@ -36,6 +36,7 @@ export class Constants { static readonly DEFAULT_FLUCTUATION_PERCENT = 5; + static readonly DEFAULT_PERFORMANCE_DIRECTORY = 'performance'; static readonly DEFAULT_PERFORMANCE_RECORDS_FILENAME = 'performanceRecords.json'; static readonly DEFAULT_PERFORMANCE_RECORDS_DB_NAME = 'e-mobility-charging-stations-simulator'; static readonly PERFORMANCE_RECORDS_TABLE = 'performance_records'; -- 2.34.1