From b38edbaa2604e5346b322064a4b7cd8387a45cb0 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jakub=20Soko=C5=82owski?= Date: Tue, 16 Oct 2018 16:09:41 -0400 Subject: [PATCH] use env variables for config MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: Jakub SokoĊ‚owski --- src/index.js | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/src/index.js b/src/index.js index 79aedaa..4989959 100644 --- a/src/index.js +++ b/src/index.js @@ -6,9 +6,9 @@ import Counter from './counter' import Redis from 'async-redis' /* DEFAULTS */ -const REDIS_HOST = 'localhost' -const REDIS_PORT = 6379 -const LISTEN_PORT = 3000 +const REDIS_HOST = process.env.REDIS_HOST || 'localhost' +const REDIS_PORT = process.env.REDIS_PORT || 6379 +const LISTEN_PORT = process.env.LISTEN_PORT || 3000 const app = new Koa() const router = new Router() @@ -29,4 +29,5 @@ app.use(JSON({pretty: true})) .use(router.allowedMethods()) app.listen(LISTEN_PORT) +console.log(`Redis connection: ${REDIS_HOST}:${REDIS_PORT}`) console.log(`Started at: http://localhost:${LISTEN_PORT}/`)