|
@ -3,9 +3,20 @@ const redis = require("ioredis") |
|
|
const moment = require('moment') |
|
|
const moment = require('moment') |
|
|
|
|
|
|
|
|
module.exports = async function factory (app, opts) { |
|
|
module.exports = async function factory (app, opts) { |
|
|
let client = new redis(opts.redis.port, opts.redis.host, { |
|
|
let client = opts.redis.pwd ? |
|
|
password: opts.redis.pwd, |
|
|
new redis.Cluster([ |
|
|
}); |
|
|
{ |
|
|
|
|
|
host: opts.redis.host, |
|
|
|
|
|
port: opts.redis.port |
|
|
|
|
|
} |
|
|
|
|
|
], { |
|
|
|
|
|
redisOptions: { |
|
|
|
|
|
password: opts.redis.pwd, |
|
|
|
|
|
}, |
|
|
|
|
|
}) |
|
|
|
|
|
: new redis(opts.redis.port, opts.redis.host, { |
|
|
|
|
|
password: opts.redis.pwd, |
|
|
|
|
|
}); |
|
|
|
|
|
|
|
|
client.on("error", function (err) { |
|
|
client.on("error", function (err) { |
|
|
app.fs.logger.error('info', '[FS-AUTH-REDIS]', 'redis connect error.'); |
|
|
app.fs.logger.error('info', '[FS-AUTH-REDIS]', 'redis connect error.'); |
|
|