mirror of
https://github.com/hexastack/hexabot
synced 2025-06-26 18:27:28 +00:00
fix(api): resolve CLI removing settings
This commit is contained in:
parent
2594434137
commit
9a7b5a3672
@ -9,7 +9,7 @@
|
|||||||
import { INestApplication } from '@nestjs/common';
|
import { INestApplication } from '@nestjs/common';
|
||||||
|
|
||||||
export class AppInstance {
|
export class AppInstance {
|
||||||
private static app: INestApplication;
|
private static app: INestApplication | null = null;
|
||||||
|
|
||||||
static setApp(app: INestApplication) {
|
static setApp(app: INestApplication) {
|
||||||
this.app = app;
|
this.app = app;
|
||||||
@ -21,4 +21,8 @@ export class AppInstance {
|
|||||||
}
|
}
|
||||||
return this.app;
|
return this.app;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static isReady(): boolean {
|
||||||
|
return this.app !== null;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
@ -8,6 +8,7 @@
|
|||||||
|
|
||||||
import { Global, Module, OnApplicationBootstrap } from '@nestjs/common';
|
import { Global, Module, OnApplicationBootstrap } from '@nestjs/common';
|
||||||
|
|
||||||
|
import { AppInstance } from '@/app.instance';
|
||||||
import { LoggerService } from '@/logger/logger.service';
|
import { LoggerService } from '@/logger/logger.service';
|
||||||
|
|
||||||
import { CleanupService } from './cleanup.service';
|
import { CleanupService } from './cleanup.service';
|
||||||
@ -24,6 +25,9 @@ export class ExtensionModule implements OnApplicationBootstrap {
|
|||||||
) {}
|
) {}
|
||||||
|
|
||||||
async onApplicationBootstrap() {
|
async onApplicationBootstrap() {
|
||||||
|
if (!AppInstance.isReady()) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
try {
|
try {
|
||||||
await this.cleanupService.pruneExtensionSettings();
|
await this.cleanupService.pruneExtensionSettings();
|
||||||
} catch (error) {
|
} catch (error) {
|
||||||
|
Loading…
Reference in New Issue
Block a user