[fix] conf

This commit is contained in:
roydfalk 2024-08-28 06:15:01 +02:00
parent 9893e60bf3
commit 8ecd0bd63e

View file

@ -221,7 +221,7 @@ namespace _espe.conf
conf_raw : any conf_raw : any
) : void ) : void
{ {
const version : int = conf_raw["version"]; const version : int = (conf_raw["version"] ?? 4);
_data = { _data = {
"general": ( "general": (
((node_general) => ({ ((node_general) => ({
@ -229,51 +229,53 @@ namespace _espe.conf
"verification_secret": (node_general["verification_secret"] ?? null), "verification_secret": (node_general["verification_secret"] ?? null),
})) (conf_raw["general"] ?? {}) })) (conf_raw["general"] ?? {})
), ),
"log": (() => { "log": (
switch (version) { (() => {
case 1: { switch (version) {
return [ 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"]
??
[
{ {
"kind": "console", "kind": "stdout",
"data": { "data": {
"threshold": ((conf_raw["general"] ?? {})["verbosity"] ?? "notice"),
} }
}, },
] ];
); break;
return ( }
node_log.map( case 2:
(node_log_entry : any) => ({ case 3:
"kind": node_log_entry["kind"], case 4: {
"data": Object.assign( const node_log = (
{ conf_raw["log"]
"format": "human_readable", ??
"threshold": "notice", [
}, {
(node_log_entry["data"] ?? {}) "kind": "stdout",
) "data": {
}) }
) },
); ]
break; );
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": ( "server": (
((node_server) => ({ ((node_server) => ({
"host": (() => { "host": (() => {