From 10e06afa907c12ae75f1d59728db561621ee6efb Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Christian=20Fra=C3=9F?= Date: Mon, 27 May 2024 22:01:56 +0200 Subject: [PATCH] [add] outputs --- source/conf.ts | 8 ++++++++ source/main.ts | 21 ++++++++++++++++----- 2 files changed, 24 insertions(+), 5 deletions(-) diff --git a/source/conf.ts b/source/conf.ts index a330dd8..089745a 100644 --- a/source/conf.ts +++ b/source/conf.ts @@ -142,6 +142,9 @@ namespace _espe.conf email_address : (null | string); } >; + output : { + authelia : (null | string); + }; }; @@ -311,6 +314,11 @@ namespace _espe.conf })) (conf_raw["settings"] ?? {}) ), "admins": (conf_raw["admins"] ?? []), + "output": ( + ((node_session_output) => ({ + "authelia": (node_session_output["authelia"] ?? null), + })) (conf_raw["output"] ?? {}) + ), }; } diff --git a/source/main.ts b/source/main.ts index af36c24..9de2b8a 100644 --- a/source/main.ts +++ b/source/main.ts @@ -230,12 +230,23 @@ async function main( ); } ); - _espe.service.member.listen_change( - async () => { - const authelia_export : string = await _espe.service.member.export_authelia_user_file(); - process.stdout.write(authelia_export + "\n"); + // outputs + { + if (_espe.conf.get().output.authelia === null) { + // do nothing } - ); + else { + _espe.service.member.listen_change( + async () => { + const authelia_export : string = await _espe.service.member.export_authelia_user_file(); + lib_plankton.file.write( + _espe.conf.get().output.authelia, + authelia_export + ); + } + ); + } + } const rest_subject : lib_plankton.rest.type_rest = _espe.api.make(); const server : lib_plankton.server.type_subject = lib_plankton.server.make(