fix(redis): Adding env vars for connecting

This commit is contained in:
Chris Troutner
2020-02-07 17:55:30 -08:00
parent 06adbc3bb1
commit 6b2a890dda
4 changed files with 19 additions and 3 deletions
+3
View File
@@ -11,6 +11,9 @@ USER safeuser
# Prep 'sudo' commands.
#RUN echo 'abcd8765' | sudo -S pwd
# Install Redis. TODO: Make this a separate container.
# Clone the repository
WORKDIR /home/safeuser
RUN git clone https://github.com/christroutner/bch-api
+7 -2
View File
@@ -3,8 +3,13 @@ bch-api:
dockerfile: Dockerfile
#image: bitcore
container_name: bch-api-main
#links:
# - mongodb
links:
- redis
ports:
- "12400:3000"
restart: always
redis:
image: redis:latest
container_name: redis-bch-api-main
restart: always
+4
View File
@@ -17,4 +17,8 @@ export NODE_TLS_REJECT_UNAUTHORIZED=0
export JWT_AUTH_SERVER=http://localhost:5001/
# Redis DB
export REDIS_PORT=6379
export REDIS_HOST=172.17.0.1
npm start
+5 -1
View File
@@ -12,7 +12,11 @@ const keyEncoder = new KeyEncoder("secp256k1")
// Redis
const Redis = require("ioredis")
const redisClient = new Redis({ enableOfflineQueue: false })
const redisClient = new Redis({
enableOfflineQueue: false,
port: process.env.REDIS_PORT ? process.env.REDIS_PORT : 6379,
host: process.env.REDIS_HOST ? process.env.REDIS_HOST : "127.0.0.1"
})
// Rate limiter middleware lib.
const { RateLimiterRedis } = require("rate-limiter-flexible")