mirror of
https://github.com/fullstack-cash/bch-api.git
synced 2026-09-21 16:52:04 -07:00
fix(redis): Adding env vars for connecting
This commit is contained in:
@@ -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
|
||||
|
||||
@@ -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
|
||||
|
||||
@@ -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
|
||||
|
||||
@@ -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")
|
||||
|
||||
Reference in New Issue
Block a user