diff --git a/.env.development b/.env.development index 5661b44..1790b2c 100644 --- a/.env.development +++ b/.env.development @@ -18,3 +18,4 @@ ADMIN_TOKEN_EXPIRESIN=1d DB_MAIN=mongodb://localhost/pyxis-development DB_SECOND=mongodb://tiku:kingsome@192.168.100.30/tiku?authSource=tiku&w=1 +REDIS=redis://127.0.0.1:6379/14 diff --git a/.env.production b/.env.production index 6ca0973..0c8eb89 100644 --- a/.env.production +++ b/.env.production @@ -17,3 +17,5 @@ ADMIN_TOKEN_EXPIRESIN=1d DB_MAIN=mongodb://188.88.0.2/pyxis-production DB_SECOND=mongodb://188.88.0.2/pyxis2-production + +REDIS=redis://127.0.0.1:6379/14 diff --git a/src/api.server.ts b/src/api.server.ts index 266cb52..1324d18 100644 --- a/src/api.server.ts +++ b/src/api.server.ts @@ -13,6 +13,7 @@ import config from 'config/config'; import { initCfgData } from './common/GConfig' import { Schedule } from './clock/Schedule' import { QCategoryCache } from './services/QCategoryCache' +import { RedisClient } from './redis/RedisClient' const zReqParserPlugin = require('plugins/zReqParser'); @@ -93,6 +94,9 @@ export class ApiServer { } catch (err) { logger.log(`DB Connection Error: ${err.message}`); } + let opts = {url: config.redis} + new RedisClient(opts) + logger.log('REDIS Connected') } private setErrHandler() { this.server.setNotFoundHandler(function(request: any, reply: { send: (arg0: { errcode: number; errmsg: string; }) => void; }){ diff --git a/src/config/config.ts b/src/config/config.ts index dc5c463..411f079 100644 --- a/src/config/config.ts +++ b/src/config/config.ts @@ -35,7 +35,8 @@ let baseConfig = { token_expiresIn: process.env.ADMIN_TOKEN_EXPIRESIN }, db_main:process.env.DB_MAIN, - db_second:process.env.DB_SECOND + db_second:process.env.DB_SECOND, + redis: process.env.REDIS }