Skip to content

Commit 35fc808

Browse files
committed
fix: request to mask variables by taskLogger
1 parent d71854d commit 35fc808

File tree

3 files changed

+8
-4
lines changed

3 files changed

+8
-4
lines changed

lib/http-server/index.ts

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ export class HttpServer {
1414
private readonly port;
1515
private readonly server;
1616

17-
constructor(private taskLogger: any) {
17+
constructor(private taskLogger?: any) {
1818
try {
1919
this.host = process.env.HOST || '0.0.0.0';
2020
this.port = +(process.env.PORT || 8080);
@@ -28,6 +28,10 @@ export class HttpServer {
2828
}
2929
}
3030

31+
setTaskLogger(taskLogger: any) {
32+
this.taskLogger = taskLogger;
33+
}
34+
3135
private initSecrets() {
3236
const secretsOptions = {
3337
schema: {
@@ -44,8 +48,7 @@ export class HttpServer {
4448

4549
this.server.post('/secrets', secretsOptions, async (request, reply) => {
4650
try {
47-
const { body }: { body: any } = request;
48-
const { secret } = body;
51+
const { body: secret }: { body: any } = request;
4952
logger.info(`got request to add new mask: ${secret.key}`);
5053
this.taskLogger.addNewMask(secret);
5154
reply.code(201);

lib/logger.js

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -86,6 +86,7 @@ class Logger {
8686
TaskLogger(this.taskLoggerConfig.task, { ...this.taskLoggerConfig.opts, updateLogsRate: true })
8787
.then((taskLogger) => {
8888
this.taskLogger = taskLogger;
89+
this.httpServer.setTaskLogger(taskLogger);
8990
taskLogger.on('error', (err) => {
9091
logger.error(err.stack);
9192
});

service.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
version: 1.12.1
1+
version: 1.12.2

0 commit comments

Comments
 (0)