🔨 Infer typings for config schema (#2656)

* 🚚 Move schema to standalone file

*  Add assertions to string literal arrays

*  Infer typings for convict schema

* 🔥 Remove unneeded assertions

* 🔨 Fix errors surfaced by typings

*  Type nodes.include/exclude per docs

*  Account for types for exception paths

*  Set method alias to flag incorrect paths

*  Replace original with alias

*  Make allowance for nodes.include

*  Adjust leftover calls

* 🔀 Fix conflicts

* 🔥 Remove unneeded castings

* 📘 Simplify exception path type

* 📦 Update package-lock.json

* 🔥 Remove unneeded imports

* 🔥 Remove unrelated file

*  Update schema

*  Update interface

* 📦 Update package-lock.json

* 📦 Update package-lock.json

* 🔥 Remove leftover assertions

Co-authored-by: Jan Oberhauser <jan.oberhauser@gmail.com>
This commit is contained in:
Iván Ovejero
2022-04-08 19:37:27 +02:00
committed by GitHub
parent 23f0501f4c
commit 37a6e329af
82 changed files with 1393 additions and 1256 deletions

View File

@@ -1,3 +1,4 @@
/* eslint-disable @typescript-eslint/no-shadow */
/* eslint-disable @typescript-eslint/no-unsafe-assignment */
import * as winston from 'winston';
@@ -11,10 +12,12 @@ class Logger implements ILogger {
private logger: winston.Logger;
constructor() {
const level = config.get('logs.level') as string;
const level = config.getEnv('logs.level');
// eslint-disable-next-line @typescript-eslint/no-shadow
const output = (config.get('logs.output') as string).split(',').map((output) => output.trim());
const output = config
.getEnv('logs.output')
.split(',')
.map((output) => output.trim());
this.logger = winston.createLogger({
// eslint-disable-next-line @typescript-eslint/no-unsafe-assignment
@@ -56,10 +59,10 @@ class Logger implements ILogger {
);
this.logger.add(
new winston.transports.File({
filename: config.get('logs.file.location'),
filename: config.getEnv('logs.file.location'),
format: fileLogFormat,
maxsize: (config.get('logs.file.fileSizeMax') as number) * 1048576, // config * 1mb
maxFiles: config.get('logs.file.fileCountMax'),
maxsize: config.getEnv('logs.file.fileSizeMax') * 1048576, // config * 1mb
maxFiles: config.getEnv('logs.file.fileCountMax'),
}),
);
}