Skip to content

Commit 5e0af65

Browse files
committed
create configService
1 parent f0481da commit 5e0af65

File tree

2 files changed

+29
-0
lines changed

2 files changed

+29
-0
lines changed

config.ts

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
import { config as configDev } from './config/config.development';
2+
import { config as configProd } from './config/config.production';
3+
4+
let config;
5+
6+
if (process.env.NODE_ENV === 'production') {
7+
config = configProd;
8+
} else {
9+
config = configDev;
10+
}
11+
12+
export default config;
Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
import { Injectable } from '@nestjs/common';
2+
import { SequelizeOrmConfig } from './interfaces/sequelize-orm-config.interface';
3+
import { JwtConfig } from './interfaces/jwt-config.interface';
4+
import config from '../../../config';
5+
6+
@Injectable()
7+
export class ConfigService {
8+
get sequelizeOrmConfig(): SequelizeOrmConfig {
9+
return config.database;
10+
}
11+
12+
get jwtConfig(): JwtConfig {
13+
return {
14+
privateKey: config.jwtPrivateKey,
15+
};
16+
}
17+
}

0 commit comments

Comments
 (0)