use env variables for config

Signed-off-by: Jakub Sokołowski <jakub@status.im>
This commit is contained in:
Jakub Sokołowski 2018-10-16 16:09:41 -04:00
parent 9b0426f6c1
commit b38edbaa26
1 changed files with 4 additions and 3 deletions

View File

@ -6,9 +6,9 @@ import Counter from './counter'
import Redis from 'async-redis' import Redis from 'async-redis'
/* DEFAULTS */ /* DEFAULTS */
const REDIS_HOST = 'localhost' const REDIS_HOST = process.env.REDIS_HOST || 'localhost'
const REDIS_PORT = 6379 const REDIS_PORT = process.env.REDIS_PORT || 6379
const LISTEN_PORT = 3000 const LISTEN_PORT = process.env.LISTEN_PORT || 3000
const app = new Koa() const app = new Koa()
const router = new Router() const router = new Router()
@ -29,4 +29,5 @@ app.use(JSON({pretty: true}))
.use(router.allowedMethods()) .use(router.allowedMethods())
app.listen(LISTEN_PORT) app.listen(LISTEN_PORT)
console.log(`Redis connection: ${REDIS_HOST}:${REDIS_PORT}`)
console.log(`Started at: http://localhost:${LISTEN_PORT}/`) console.log(`Started at: http://localhost:${LISTEN_PORT}/`)