ditch nestjs config module, add static config serfice

This commit is contained in:
Jurgis Sakalauskas
2022-12-09 11:37:44 +02:00
parent b353e00bec
commit 7e5fa1fb2a
11 changed files with 86 additions and 102 deletions
+2 -1
View File
@@ -3,6 +3,7 @@ import { NextFunction } from 'express';
import { Request, Response } from 'express';
import { appendFile } from 'fs';
import { join } from 'path';
import { configService } from '../config/config.service';
export class RequestLogMiddleware implements NestMiddleware {
async use(req: Request, res: Response, next: NextFunction) {
@@ -32,7 +33,7 @@ export class RequestLogMiddleware implements NestMiddleware {
private log(message: string) {
const strTime = new Date().toISOString();
const logFile = join(__dirname, process.env.LOG_FILE_REQUESTS);
const logFile = configService.getStaticRequestsLogPath();
appendFile(logFile, strTime + ' ' + message + '\n', function (err) {
if (err) {
console.log('error logging ' + message);