From e868378e7c9d0443da8bb47433140d7d36f55cdd Mon Sep 17 00:00:00 2001 From: AdeyinkaOresanya Date: Wed, 20 Sep 2023 11:43:31 +0100 Subject: [PATCH 1/3] [REFACTOR]: refactor function smee in index.js to make it more dynamic Signed-off-by: Adeyinka Oresanya adeyinkaoresanya@gmail.com --- index.js | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/index.js b/index.js index 03c023c..29f0c1a 100644 --- a/index.js +++ b/index.js @@ -71,8 +71,8 @@ app.listen(process.env.PORT, () => const SmeeClient = require("smee-client"); const smee = new SmeeClient({ - source: "https://smee.io/badging", - target: "http://localhost:2020", + source: process.env.source, + target: `http://localhost:${process.env.PORT}`, logger: console, }); From 255f1b0e0127256866f9d43ae6742289eba4020d Mon Sep 17 00:00:00 2001 From: AdeyinkaOresanya Date: Mon, 25 Sep 2023 11:26:17 +0100 Subject: [PATCH 2/3] [REFACTOR]: Refactor smeeClient to run only in development environment. Signed-off-by: Adeyinka Oresanya adeyinkaoresanya@gmail.com --- index.js | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/index.js b/index.js index 29f0c1a..616c7e4 100644 --- a/index.js +++ b/index.js @@ -65,10 +65,11 @@ app.get("/logs", (req, res) => { }); app.listen(process.env.PORT, () => - logger.info(`App listening on PORT:${process.env.PORT}`) +logger.info(`App listening on PORT:${process.env.PORT}`) ); -const SmeeClient = require("smee-client"); +if (process.env.NODE_ENV === "development") { + const SmeeClient = require("smee-client"); const smee = new SmeeClient({ source: process.env.source, @@ -77,3 +78,5 @@ const smee = new SmeeClient({ }); smee.start(); +} + From f33d31a588b2229035b963806f7006037fae52c1 Mon Sep 17 00:00:00 2001 From: AdeyinkaOresanya Date: Mon, 25 Sep 2023 11:37:21 +0100 Subject: [PATCH 3/3] [REFACTOR]: Refactor smeeClient to run only in development environment. Signed-off-by: Adeyinka Oresanya adeyinkaoresanya@gmail.com --- index.js | 1 + 1 file changed, 1 insertion(+) diff --git a/index.js b/index.js index 616c7e4..821fc6f 100644 --- a/index.js +++ b/index.js @@ -68,6 +68,7 @@ app.listen(process.env.PORT, () => logger.info(`App listening on PORT:${process.env.PORT}`) ); + if (process.env.NODE_ENV === "development") { const SmeeClient = require("smee-client");