Files
liqa/server/src/app.module.ts
T
ars9 9f341719ef feat(database): manage the schema with typeorm migrations
- replace synchronize with migrations, starting with a generated initial
  migration that adopts databases created by synchronize
- apply pending migrations in the docker container before the server,
  and refuse to start the server while migrations are pending
- share one entity list and data source between app, migration runner,
  typeorm cli and tests; tests run the real migrations
- add migration:run, migration:show and migration:generate scripts and
  a test that fails when entities and migrations differ
- exit with code 1 when startup fails
- bump version to 1.20.0
2026-09-30 21:45:42 +03:00

49 lines
1.7 KiB
TypeScript

import { Module } from "@nestjs/common";
import { ConfigModule, ConfigService } from "@nestjs/config";
import { ScheduleModule } from "@nestjs/schedule";
import { ServeStaticModule } from "@nestjs/serve-static";
import { TypeOrmModule } from "@nestjs/typeorm";
import { BrowserModule } from "./browser/browser.module";
import { clientStaticOptions } from "./common/client-static";
import { dataSourceOptions } from "./database/data-source";
import { AppConfig, validateAppConfig } from "./config/app.config";
import { CredentialModule } from "./credential/credential.module";
import { EnvironmentModule } from "./environment/environment.module";
import { FileModule } from "./file/file.module";
import { HealthModule } from "./health/health.module";
import { ImportModule } from "./import/import.module";
import { McpModule } from "./mcp/mcp.module";
import { ScenarioModule } from "./scenario/scenario.module";
import { SnippetModule } from "./snippet/snippet.module";
@Module({
imports: [
ConfigModule.forRoot({
isGlobal: true,
envFilePath: ".env",
validate: validateAppConfig,
}),
ScheduleModule.forRoot(),
ServeStaticModule.forRootAsync({
inject: [ConfigService],
useFactory: (config: ConfigService<AppConfig, true>) =>
clientStaticOptions(config.get("CLIENT_DIR")),
}),
TypeOrmModule.forRootAsync({
inject: [ConfigService],
useFactory: (config: ConfigService<AppConfig, true>) =>
dataSourceOptions(config.get("DB_PATH")),
}),
BrowserModule,
EnvironmentModule,
CredentialModule,
ScenarioModule,
SnippetModule,
FileModule,
ImportModule,
McpModule,
HealthModule,
],
})
export class AppModule {}