From 77ac4066d9d824e8e58daeb52021ccfe90d40bf2 Mon Sep 17 00:00:00 2001 From: Junior Date: Thu, 25 May 2023 20:46:21 -0300 Subject: [PATCH] Add PUBLIC_IP env variable --- .env | 5 +++-- src/app.js | 9 +++++---- 2 files changed, 8 insertions(+), 6 deletions(-) diff --git a/.env b/.env index 7568a6d..85e79f0 100644 --- a/.env +++ b/.env @@ -3,6 +3,7 @@ ################################## # Set the port for receiving connections +PUBLIC_IP= PORT=3000 AUTH_PORT=8070 BILLING_PORT=8080 @@ -16,7 +17,7 @@ ENABLE_HELMET=false TZ=America/New_York ################################## -# LOGGING CONFIGURATION # +# LOGGING CONFIGURATION # ################################## LOG_LEVEL=info @@ -27,7 +28,7 @@ LOG_ACCOUNT_CONSOLE=false LOG_MAILER_CONSOLE=false ################################## -# API DATABASE CONFIGURATION # +# API DATABASE CONFIGURATION # ################################## # Set a host to connect to the SQL server database. diff --git a/src/app.js b/src/app.js index ed399c7..f7c7db1 100644 --- a/src/app.js +++ b/src/app.js @@ -94,8 +94,9 @@ app.use((err, req, res, next) => { // Start server const port = process.env.PORT || 3000; -app.listen(port, '0.0.0.0', () => { - logger.info(`API listening on *:${port}`); - logger.info(`Auth API listening on 127.0.0.1:${authPort}`); - logger.info(`Billing API listening on 127.0.0.1:${billingPort}`); +const publicIP = process.env.PUBLIC_IP || '0.0.0.0'; +app.listen(port, publicIP, () => { + logger.info(`API listening on ${publicIP}:${port}`); + logger.info(`Auth API listening on ${publicIP}:${authPort}`); + logger.info(`Billing API listening on ${publicIP}:${billingPort}`); }); \ No newline at end of file