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(