Skip to content

Commit

Permalink
Read APP HOST from config
Browse files Browse the repository at this point in the history
  • Loading branch information
xianjiezh committed Oct 24, 2020
1 parent 6484469 commit 059b8a1
Showing 1 changed file with 6 additions and 1 deletion.
7 changes: 6 additions & 1 deletion src/common/cache-manager.ts
Original file line number Diff line number Diff line change
@@ -1,18 +1,23 @@
import * as redisStore from 'cache-manager-redis-store';
import * as cacheManager from 'cache-manager';
import * as dotenv from 'dotenv';
import * as fs from 'fs';

import { IRequestUser } from 'src/auth/auth.controller';

export const ttl = 3

const envConfig = dotenv.parse(fs.readFileSync(process.env.CONFIG_PATH || 'develop.env'));

const { APP_HOST } = envConfig;


export const RedisProvider = {
provide: 'REDIS_MANAGER',
useFactory: () => {
const redisCache = cacheManager.caching({
store: redisStore,
host: '127.0.0.1', // default value
host: APP_HOST, // default value
port: 9301, // default value
db: 0,
ttl,
Expand Down

0 comments on commit 059b8a1

Please sign in to comment.