From 080a3796d74a55186c35d1a61a98bc7f3a409f75 Mon Sep 17 00:00:00 2001 From: Dev Aggarwal Date: Fri, 23 Oct 2020 10:57:32 +0530 Subject: [PATCH] .env --- package-lock.json | 5 +++++ package.json | 1 + src/index.js | 7 +++++-- 3 files changed, 11 insertions(+), 2 deletions(-) diff --git a/package-lock.json b/package-lock.json index 2c01005..c9673cb 100644 --- a/package-lock.json +++ b/package-lock.json @@ -418,6 +418,11 @@ "domelementtype": "1" } }, + "dotenv": { + "version": "8.2.0", + "resolved": "https://registry.npmjs.org/dotenv/-/dotenv-8.2.0.tgz", + "integrity": "sha512-8sJ78ElpbDJBHNeBzUbUVLsqKdccaa/BXF1uPTw3GrvQTBgrQrtObr2mUrE38vzYd8cEv+m/JBfDLioYcfXoaw==" + }, "end-of-stream": { "version": "1.4.4", "resolved": "https://registry.npmjs.org/end-of-stream/-/end-of-stream-1.4.4.tgz", diff --git a/package.json b/package.json index c6674c3..a173e1a 100644 --- a/package.json +++ b/package.json @@ -9,6 +9,7 @@ "author": "", "license": "ISC", "dependencies": { + "dotenv": "^8.2.0", "got": "^11.8.0", "metascraper": "^5.14.18", "metascraper-description": "^5.14.18", diff --git a/src/index.js b/src/index.js index e55b5f8..6b18eff 100644 --- a/src/index.js +++ b/src/index.js @@ -7,10 +7,13 @@ const got = require("got"); const zmq = require("zeromq"); const twitter = require("twitter-text"); +require("dotenv").config(); +const BIND_ADDR = process.env.BIND_ADDR; + (async function() { const sock = zmq.socket("rep"); - console.log('serving @ "tcp://127.0.0.1:3000"'); - await sock.bind("tcp://127.0.0.1:3000"); + await sock.bind(BIND_ADDR); + console.log(`serving @ "${BIND_ADDR}"`); sock.on("message", async function(msg) { msg = JSON.parse(msg);