diff --git a/game-server/app.js b/game-server/app.js index 0cf333c..2a115da 100644 --- a/game-server/app.js +++ b/game-server/app.js @@ -18,7 +18,7 @@ const redisConfig = pomelo.app.get("redis"); app.use(globalChannel, { globalChannel: { host: redisConfig.host, port: redisConfig.port, - db: '0' + db: redisConfig.db, }}); var chatRoute = function(session, msg, app, cb) { @@ -60,7 +60,7 @@ app.configure('production|development', 'master', function() { const config = redisConfig; // cleanup redis const client = redis.createClient({ - url: `redis://${config.host}:${config.port}`, + url: `redis://${config.host}:${config.port}/${config.db}`, }); client.on("error", (err) => { @@ -69,7 +69,7 @@ app.configure('production|development', 'master', function() { async function init() { await client.connect(); - await client.flushAll(); + await client.flushDb(); client.disconnect(); } init(); diff --git a/game-server/app/dao/userDao.js b/game-server/app/dao/userDao.js index b61bdfc..c15b3a9 100644 --- a/game-server/app/dao/userDao.js +++ b/game-server/app/dao/userDao.js @@ -6,7 +6,7 @@ const { query_game, query_guild } = require("../lib/db"); const config = pomelo.app.get("redis"); const client = redis.createClient({ - url: `redis://${config.host}:${config.port}`, + url: `redis://${config.host}:${config.port}/${config.db}`, }); client.on("error", (err) => { diff --git a/game-server/config/redis.json b/game-server/config/redis.json index df6c352..b8b85c9 100644 --- a/game-server/config/redis.json +++ b/game-server/config/redis.json @@ -1,16 +1,19 @@ { "development": { "host" : "192.168.100.173", - "port" : "6379" + "port" : "6379", + "db" : 1 }, "production": { "host" : "192.168.100.173", - "port" : "6379" + "port" : "6379", + "db" : 0 }, "dchat": { "host" : "192.168.100.173", - "port" : "6379" + "port" : "6379", + "db" : 0 } } \ No newline at end of file