From 8ecd0bd63ed8390df1c0bfd899af0a91ca7af64e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Christian=20Fra=C3=9F?= Date: Wed, 28 Aug 2024 06:15:01 +0200 Subject: [PATCH] [fix] conf --- source/conf.ts | 84 ++++++++++++++++++++++++++------------------------ 1 file changed, 43 insertions(+), 41 deletions(-) diff --git a/source/conf.ts b/source/conf.ts index a8eacb3..a662638 100644 --- a/source/conf.ts +++ b/source/conf.ts @@ -221,7 +221,7 @@ namespace _espe.conf conf_raw : any ) : void { - const version : int = conf_raw["version"]; + const version : int = (conf_raw["version"] ?? 4); _data = { "general": ( ((node_general) => ({ @@ -229,51 +229,53 @@ namespace _espe.conf "verification_secret": (node_general["verification_secret"] ?? null), })) (conf_raw["general"] ?? {}) ), - "log": (() => { - switch (version) { - case 1: { - return [ - { - "kind": "stdout", - "data": { - "threshold": ((conf_raw["general"] ?? {})["verbosity"] ?? "notice"), - } - }, - ]; - break; - } - case 2: - case 3: - case 4: { - const node_log = ( - conf_raw["log"] - ?? - [ + "log": ( + (() => { + switch (version) { + case 1: { + return [ { - "kind": "console", + "kind": "stdout", "data": { + "threshold": ((conf_raw["general"] ?? {})["verbosity"] ?? "notice"), } }, - ] - ); - return ( - node_log.map( - (node_log_entry : any) => ({ - "kind": node_log_entry["kind"], - "data": Object.assign( - { - "format": "human_readable", - "threshold": "notice", - }, - (node_log_entry["data"] ?? {}) - ) - }) - ) - ); - break; + ]; + break; + } + case 2: + case 3: + case 4: { + const node_log = ( + conf_raw["log"] + ?? + [ + { + "kind": "stdout", + "data": { + } + }, + ] + ); + return ( + node_log.map( + (node_log_entry : any) => ({ + "kind": node_log_entry["kind"], + "data": Object.assign( + { + "format": "human_readable", + "threshold": "notice", + }, + (node_log_entry["data"] ?? {}) + ) + }) + ) + ); + break; + } } - } - }) (), + }) () + ), "server": ( ((node_server) => ({ "host": (() => {