-
-
Notifications
You must be signed in to change notification settings - Fork 100
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
7.0.0 #593
7.0.0 #593
Conversation
51239da
to
00b32cc
Compare
@BrunnerLivio thanks for your work on this. Cannot wait to include it in my application. |
838ec57
to
795ce21
Compare
@neverson-silva hopefully sometime this week. You can already opt-in to use the prerelease though
See migration guide (work in progress). Though before you migrate, can you check whether everything works fine just by upgrading the dependency? It should be backward-compatible and only print a deprecation warning. |
@BrunnerLivio thanks for your reply, everything worked very well. I'll read the migration guide. |
Hey, I noticed an issue with the new v7 syntax. |
@geekflyer Great catch, I will need to add this as a note to the migration guide! Unfortunately, I can’t. Though you can:
// my-health.service.ts
@Injectable()
export class MyHealthService {
constructor(
private health: HealthCheckService,
private dns: DNSHealthIndicator,
) {}
healthcheck() {
return this.health.check([
() => this.dns.pingCheck('nestjs', 'https://nestjs.com'),
]);
}
}
// main.ts
async function bootstrap() {
const app = await NestFactory.create(AppModule);
app.enableShutdownHooks();
const myHealthService = app.get(MyHealthService);
app.getHttpAdapter().get('/health', async (_, res) => {
try {
const result = await myHealthService.healthcheck();
return res.status(200).json(result);
} catch (error) {
return res.status(500).json(error.response);
}
});
await app.listen(3000);
}
bootstrap(); |
ok, let's say i wanna continue using the old syntax, is there a way to disable the deprecation warning? |
08e0c74
to
0a75913
Compare
@geekflyer added an environment variable |
@BrunnerLivio , thanks, but I wonder could you rather make this a parameter of the forRootAsync method? something like: TerminusModule.forRootAsync({
ignoreDeprecationWarning: true,
useFactory: (disk: DiskHealthIndicator) => {
return {
endpoints: [
{
url: '/health',
healthIndicators: [
async () =>
disk.checkStorage('disk', {
path: '/',
thresholdPercent: 0.5,
}),
],
},
],
};
},
inject: [DiskHealthIndicator],
}), or TerminusModule.forRootAsync({
useFactory: (disk: DiskHealthIndicator) => {
return {
ignoreDeprecationWarning: true,
endpoints: [
{
url: '/health',
healthIndicators: [
async () =>
disk.checkStorage('disk', {
path: '/',
thresholdPercent: 0.5,
}),
],
},
],
};
},
inject: [DiskHealthIndicator],
}), I think using an environment variable to suppress the deprecation warning seems a bit heavy handed :) |
@geekflyer personally I don’t really like that (seems to me a little bit unintuitive design), but I can’t come up with a strong unopinionated counter argument either haha. Since these options will anyway get removed in v8 I don’t really care. Therefore I’ll refactor the env variable asap |
awesome thanks! |
@geekflyer @ everyone: The PR is almost done. If you are able to check out the pre-release |
lib/health-indicator/microservice/external/microservice-options.interface.ts
Outdated
Show resolved
Hide resolved
lib/health-indicator/microservice/external/serializer.interface.ts
Outdated
Show resolved
Hide resolved
Co-Authored-By: Kamil Mysliwiec <mail@kamilmysliwiec.com>
aefd3c8
to
fc30052
Compare
Terminus v7 has been released! Migration guide to be followed asap. |
PR Checklist
Please check if your PR fulfills the following requirements:
PR Type
What kind of change does this PR introduce?
What is the current behavior?
Issue Number: #9 #32 #33 #312 #340 #561 #569 #580
What is the new behavior?
One of the main goals I want to tackle is the very complicated JSON object for the
TerminusModule.forRootAsync
.v6
v7
The v6 way of registering health checks will mostly stay in the package without any further action needed for most users. It will get completely removed in v8.
Does this PR introduce a breaking change?
Todo @BrunnerLivio