From 761bb1a2f3702ef4b4c62c72ce03da8f590355d8 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Alejandro=20Ojeda=20Guti=C3=A9rrez?= <63747287+alexojegu@users.noreply.github.com> Date: Sun, 26 Nov 2023 11:48:38 +0100 Subject: [PATCH 1/3] Don't create `STORE_DIR/logs` if `ZWAVEJS_LOGS_DIR` is setted. Currently, if `ZWAVEJS_LOGS_DIR` is setted, the `STORE_DIR/logs` directory continues to be created without any content being saved in it. --- api/config/app.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/api/config/app.ts b/api/config/app.ts index 8bc71f73eb5..e2992f0dfe5 100644 --- a/api/config/app.ts +++ b/api/config/app.ts @@ -6,7 +6,7 @@ config({ path: './.env.app' }) // config/app.js export const title: string = 'Z-Wave JS UI' export const storeDir: string = process.env.STORE_DIR || joinPath(true, 'store') -export const logsDir: string = joinPath(storeDir, 'logs') +export const logsDir: string = process.env.ZWAVEJS_LOGS_DIR || joinPath(storeDir, 'logs') export const snippetsDir: string = joinPath(storeDir, 'snippets') export const tmpDir: string = joinPath(storeDir, '.tmp') From f4c8ddda7d4a768eaaace2bd8083f53406cdacd5 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Alejandro=20Ojeda=20Guti=C3=A9rrez?= <63747287+alexojegu@users.noreply.github.com> Date: Sun, 26 Nov 2023 11:59:28 +0100 Subject: [PATCH 2/3] feat(config): `logsDir` already has the correct path --- api/lib/ZwaveClient.ts | 5 +---- 1 file changed, 1 insertion(+), 4 deletions(-) diff --git a/api/lib/ZwaveClient.ts b/api/lib/ZwaveClient.ts index 9a41331f340..493a99994cb 100644 --- a/api/lib/ZwaveClient.ts +++ b/api/lib/ZwaveClient.ts @@ -305,10 +305,7 @@ export type SensorTypeScale = { export type AllowedApis = (typeof allowedApis)[number] -const ZWAVEJS_LOG_FILE = utils.joinPath( - process.env.ZWAVEJS_LOGS_DIR || logsDir, - 'zwavejs_%DATE%.log', -) +const ZWAVEJS_LOG_FILE = utils.joinPath(logsDir, 'zwavejs_%DATE%.log') export type ZUIValueIdState = { text: string From 316ecdb58b91d49b292babca50b034244bacf242 Mon Sep 17 00:00:00 2001 From: Z-Wave JS Bot Date: Mon, 27 Nov 2023 11:18:41 +0000 Subject: [PATCH 3/3] style: fix lint --- api/config/app.ts | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/api/config/app.ts b/api/config/app.ts index e2992f0dfe5..30727220c3a 100644 --- a/api/config/app.ts +++ b/api/config/app.ts @@ -6,7 +6,8 @@ config({ path: './.env.app' }) // config/app.js export const title: string = 'Z-Wave JS UI' export const storeDir: string = process.env.STORE_DIR || joinPath(true, 'store') -export const logsDir: string = process.env.ZWAVEJS_LOGS_DIR || joinPath(storeDir, 'logs') +export const logsDir: string = + process.env.ZWAVEJS_LOGS_DIR || joinPath(storeDir, 'logs') export const snippetsDir: string = joinPath(storeDir, 'snippets') export const tmpDir: string = joinPath(storeDir, '.tmp')