Fix bad place of use for redis pass

This commit is contained in:
Alice Gaudon 2020-04-25 18:31:54 +02:00
parent 6868411aa7
commit fc5344c629
2 changed files with 4 additions and 3 deletions

View File

@ -1,6 +1,6 @@
{ {
"name": "wms-core", "name": "wms-core",
"version": "0.4.18", "version": "0.4.19",
"description": "Node web framework", "description": "Node web framework",
"repository": "git@gitlab.com:ArisuOngaku/wms-core.git", "repository": "git@gitlab.com:ArisuOngaku/wms-core.git",
"author": "Alice Gaudon <alice@gaudon.pro>", "author": "Alice Gaudon <alice@gaudon.pro>",

View File

@ -13,14 +13,15 @@ export default class RedisComponent extends ApplicationComponent<void> {
private store?: Store; private store?: Store;
public async start(app: Express, router: Router): Promise<void> { public async start(app: Express, router: Router): Promise<void> {
this.redisClient = redis.createClient(config.get('redis.port'), config.get('redis.host'), {}); this.redisClient = redis.createClient(config.get('redis.port'), config.get('redis.host'), {
password: config.has('redis.password') ? config.get<string>('redis.password') : undefined,
});
this.redisClient.on('error', (err: any) => { this.redisClient.on('error', (err: any) => {
Logger.error(err, 'An error occurred with redis.'); Logger.error(err, 'An error occurred with redis.');
}); });
this.store = new RedisStore({ this.store = new RedisStore({
client: this.redisClient, client: this.redisClient,
prefix: config.get<string>('redis.prefix') + '-session:', prefix: config.get<string>('redis.prefix') + '-session:',
pass: config.has('redis.password') ? config.get<string>('redis.password') : undefined,
}); });
} }