From b9d992a4d0649a897e7ec1341479723acb5979d9 Mon Sep 17 00:00:00 2001 From: urvishp80 Date: Mon, 30 Oct 2023 10:16:24 -0400 Subject: [PATCH] handle URL and NAME combination --- mailing-list/main.js | 16 ++++++++++++++-- 1 file changed, 14 insertions(+), 2 deletions(-) diff --git a/mailing-list/main.js b/mailing-list/main.js index a95b484..7b3680e 100644 --- a/mailing-list/main.js +++ b/mailing-list/main.js @@ -16,7 +16,19 @@ const { count } = require("console"); -const URL = process.env.URL || "https://lists.linuxfoundation.org/pipermail/bitcoin-dev/"; +let URL = process.env.URL || "https://lists.linuxfoundation.org/pipermail/bitcoin-dev/"; +let NAME = process.env.NAME || "bitcoin"; + +if (URL === "https://lists.linuxfoundation.org/pipermail/bitcoin-dev/") { + NAME = "bitcoin"; +} else if (URL === 'https://lists.linuxfoundation.org/pipermail/lightning-dev/') { + NAME = "lightning"; +} + +console.log( + `NAME: ${NAME}\nURL: ${URL}` +); + const MONTHS = [ "January", @@ -145,7 +157,7 @@ function parse_dumps() { const fileDate = file.split("-")[0] + "-" + file.split("-")[1]; const fileName = file.split("-")[2]; const document = { - id: "mailing-list-" + process.env.NAME + '-' + file.replace(".html", ""), + id: "mailing-list-" + NAME + '-' + file.replace(".html", ""), authors: [author], title, body: bodyText,