const redis = require("redis");
const session = require("express-session");
const RedisStore = require("connect-redis")(session);
const REDIS_HOST = process.env.REDIS_HOST || "localhost"
const REDIS_PORT = process.env.REDIS_PORT || 6379
let redisClient = redis.createClient({
host: REDIS_HOST,
port: REDIS_PORT
});
module.exports = session({
store: new RedisStore({ client: redisClient }),
secret: "super-secret-key", // TBD: grab from env
resave: false,
saveUninitialized: false,
cookie: {
maxAge: 1000 * 60 * 60 * 24,
secure: false // require HTTPS in production
}
});
`
none
events.js:187
throw er; // Unhandled 'error' event
^
Error: Redis connection to 192.168.101.47:6379 failed - connect ECONNREFUSED 192.168.101.47:6379
at TCPConnectWrap.afterConnect [as oncomplete] (net.js:1128:14) Emitted 'error' event on RedisClient instance at:
at RedisClient.on_error (/mnt/d/Work/TimoBakker_PeterRahman/skrollo/skrollo/node_modules/redis/index.js:406:14)
at Socket.<anonymous> (/mnt/d/Work/TimoBakker_PeterRahman/skrollo/skrollo/node_modules/redis/index.js:279:14)
at Socket.emit (events.js:210:5)
at Socket.EventEmitter.emit (domain.js:476:20)
at emitErrorNT (internal/streams/destroy.js:92:8)
at emitErrorAndCloseNT (internal/streams/destroy.js:60:3)
at processTicksAndRejections (internal/process/task_queues.js:80:21) { errno: 'ECONNREFUSED', code: 'ECONNREFUSED', syscall: 'connect', address: '192.168.101.47', port: 6379 }
`