From 6c93cff3bb522d93bb54d18a08fca29f77c96156 Mon Sep 17 00:00:00 2001 From: Mohamad Ihsan Date: Wed, 18 Oct 2023 11:17:06 +0700 Subject: [PATCH] update --- env | 22 ++++++++++++---------- index.js | 16 +++++++++++----- 2 files changed, 23 insertions(+), 15 deletions(-) diff --git a/env b/env index a634128..f6c6a57 100644 --- a/env +++ b/env @@ -3,17 +3,19 @@ NODE_ENV=development CUSTOM_MODE_NODE_ENV=devprod #NODE_ENV=testing - -RUNNING_ON_MULTIPLE_PORT=true - PORT=3000 -PORT3001=3001 -PORT3002=3002 -PORT3003=3003 -PORT3004=3004 - VERSION=v1.4.6 +# ===================== CLUSTER NODE (YES or NO) =========================== +CLUSTER_NODE=NO + +# ===================== CLUSTER WITH RUNNING ON MULTIPLE PORT (YES or NO) =========================== +RUNNING_ON_MULTIPLE_PORT=NO + +# PISAHKAN DENGAN MENGGUNAKAN SEPARATOR KOMA TANPA SPASI +PORTS=3001,3002,3003,3004 + + # =========================== KONFIGURASI UNTUK SERVER =========================== # SERVER_FOR=development #SERVER_FOR=production @@ -39,9 +41,9 @@ DB_USER_POOLING=postgres DB_PASSWORD_POOLING=inhc0mmute_cms # ==================================== LOKI ===================================== -LOKI_URL=http://10.20.14.30:3100 +LOKI_URL=http://localhost:3100 -# ==================================== APP PROMETHEUS ===================================== +# =============================== APP PROMETHEUS ================================= PROM_APP = topuponline # ================================== SECRET KEY ================================== diff --git a/index.js b/index.js index 095ee23..2e98822 100644 --- a/index.js +++ b/index.js @@ -60,12 +60,18 @@ function startExpress() { // set port, listen for requests const PORT = process.env.PORT || 3000; + let message = `Server is running on version ${ + process.env.VERSION + } environment: ${process.env.NODE_ENV.toUpperCase()} port: ${PORT} on ${serverActive}. HSM STATUS : ${serverHSMStatus} `; + + if (process.env.CLUSTER_NODE.toUpperCase() == 'YES') { + message = `Server is running with cluster node on version ${ + process.env.VERSION + } environment: ${process.env.NODE_ENV.toUpperCase()} port: ${PORT} on ${serverActive}. HSM STATUS : ${serverHSMStatus} `; + } + app.listen(PORT, () => { - winston.logger.info( - `Server is running on version ${ - process.env.VERSION - } environment: ${process.env.NODE_ENV.toUpperCase()} port: ${PORT} on ${serverActive}. HSM STATUS : ${serverHSMStatus} ` - ); + winston.logger.info(message); }); // jika settingan running on multiple