@lxdhub/dbsync
Version:
Display, search and copy LXD-images using a web interface.
39 lines • 1.29 kB
JavaScript
;
Object.defineProperty(exports, "__esModule", { value: true });
const core_1 = require("@nestjs/core");
const app_module_1 = require("./app.module");
const app_service_1 = require("./app.service");
const db_1 = require("@lxdhub/db");
/**
* Represents the LXDHub Database synchronization script.
* It synchronizes the database with the given remotes.
*/
class LXDHubDbSync {
/**
* Initializes the database synchronization script
* @param settings The database synchronisation settings
*/
constructor(settings) {
this.settings = settings;
}
/**
* Bootstraps the NestJS application
* and requests the app service
*/
async bootstrap() {
this.app = await core_1.NestFactory.createApplicationContext(app_module_1.AppModule.forRoot(this.settings));
this.app.enableShutdownHooks();
this.databaseService = this.app.get(db_1.DatabaseService);
this.appService = this.app.get(app_service_1.AppService);
}
/**
* Runs the database synchronization task
*/
async run() {
await this.bootstrap();
await this.appService.synchronize();
await this.databaseService.closeConnection();
}
}
exports.LXDHubDbSync = LXDHubDbSync;
//# sourceMappingURL=main.js.map