Skip to content

Commit 75666c9

Browse files
committed
Configure health check service through configuration
1 parent 8b7034d commit 75666c9

File tree

2 files changed

+12
-16
lines changed

2 files changed

+12
-16
lines changed

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "nest-status-monitor",
3-
"version": "0.0.1",
3+
"version": "0.0.2",
44
"description": "Realtime Monitoring for Express-based Node applications",
55
"main": "dist/index.js",
66
"repository": {

src/health.check.service.ts

Lines changed: 11 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -1,22 +1,18 @@
1-
import { Injectable } from '@nestjs/common';
1+
import { Injectable, Inject } from '@nestjs/common';
22
import axios from 'axios';
3+
import { STATUS_MONITOR_OPTIONS_PROVIDER } from './status.monitor.constants';
4+
import { StatusMonitorConfiguration } from './config/status.monitor.configuration';
5+
import { HealthCheckConfiguration } from './config/health.check.configuration';
36

47
@Injectable()
58
export class HealthCheckService {
6-
healthChecks = [
7-
{
8-
protocol: 'http',
9-
host: 'localhost',
10-
path: '/healt/alive',
11-
port: '3001',
12-
},
13-
{
14-
protocol: 'http',
15-
host: 'localhost',
16-
path: '/healt/dead',
17-
port: '3001',
18-
},
19-
];
9+
healthChecks: HealthCheckConfiguration[] = [];
10+
11+
constructor(
12+
@Inject(STATUS_MONITOR_OPTIONS_PROVIDER) config: StatusMonitorConfiguration,
13+
) {
14+
this.healthChecks = config.healthChecks;
15+
}
2016

2117
checkAllEndpoints() {
2218
const checkPromises = [];

0 commit comments

Comments
 (0)