Skip to content

Commit

Permalink
chore(elk): update document info
Browse files Browse the repository at this point in the history
  • Loading branch information
rudemex committed May 20, 2024
1 parent 7e7b668 commit a0283d9
Show file tree
Hide file tree
Showing 3 changed files with 12 additions and 7 deletions.
7 changes: 5 additions & 2 deletions packages/elk/src/elk/services/elk.service.ts
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,9 @@ import { ConfigService } from '@nestjs/config';
import { getCode, getErrorMessage } from '@tresdoce-nestjs-toolkit/filters';
import { excludePaths } from '@tresdoce-nestjs-toolkit/core';
import { FormatService, RedactService } from '@tresdoce-nestjs-toolkit/utils';
import { Client } from '@elastic/elasticsearch';
import { Request, Response } from 'express';
import { v4 as uuid } from 'uuid';
import _ from 'lodash';

import { ELK_MODULE_OPTIONS, ELK_CLIENT } from '../constants/elk.constant';
Expand All @@ -24,7 +26,7 @@ export class ElkService {
@Inject(FormatService) private readonly formatService: FormatService,
@Inject(RedactService) private readonly redactService: RedactService,
@Inject(ELK_MODULE_OPTIONS) private readonly options: ElasticsearchOptions,
@Inject(ELK_CLIENT) private readonly elkClient,
@Inject(ELK_CLIENT) private readonly elkClient: Client,
) {}

get clientRef() {
Expand Down Expand Up @@ -56,7 +58,8 @@ export class ElkService {
try {
await this.clientRef?.index({
index: this.generateIndexDocument(_suffix),
body: elkDocument,
id: `${uuid()}`,
document: elkDocument,
});
} catch (_error) {
/* istanbul ignore next */
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,16 +8,17 @@ export const initDockerCompose = (
_services?: Array<string>,
_composeFilePath = '.',
_composeFile = 'docker-compose.yml',
_startupTimeout = 60000,
) => {
return async (): Promise<StartedDockerComposeEnvironment> => {
console.info(`🐳 Initialize docker-compose...`);
_.isEmpty(_services)
? console.log(`• All services from ${_composeFile}`)
: console.log(`• Services from ${_composeFile}: ${_services.join(', ')}`);
try {
environment = await new DockerComposeEnvironment(_composeFilePath, _composeFile).up(
_services,
);
environment = await new DockerComposeEnvironment(_composeFilePath, _composeFile)
.withStartupTimeout(_startupTimeout)
.up(_services);
global.__TESTCONTAINERS__ = environment;
console.info(`✨ Container(s) initialized.`);
return environment;
Expand Down
5 changes: 3 additions & 2 deletions packages/test-utils/src/utilities/utils.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
import path from 'path';

export const delay = async (timeout = 10000) => new Promise((r) => setTimeout(r, timeout));
export const delay = async (timeout: number = 10000): Promise<any> =>
await new Promise((r) => setTimeout(r, timeout));

export const pathJoin = (dirName, fileName) => path.join(dirName, fileName);
export const pathJoin = (dirName: string, fileName: string) => path.join(dirName, fileName);

0 comments on commit a0283d9

Please sign in to comment.