MCPcopy
hub / github.com/immich-app/immich / setup

Method setup

server/src/bin/sync-sql.ts:72–101  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

70 }
71
72 private async setup() {
73 await rm(this.options.targetDir, { force: true, recursive: true });
74 await mkdir(this.options.targetDir);
75
76 if (!process.env.DB_HOSTNAME) {
77 process.env.DB_HOSTNAME = 'localhost';
78 }
79 const { database, cls, otel } = new ConfigRepository().getEnv();
80
81 const moduleFixture = await Test.createTestingModule({
82 imports: [
83 KyselyModule.forRoot({
84 ...getKyselyConfig(database.config),
85 log: (event) => {
86 if (event.level === 'query') {
87 this.sqlLogger.logQuery(event.query.sql);
88 } else if (event.level === 'error') {
89 this.sqlLogger.logQueryError(event.error as Error, event.query.sql);
90 this.sqlLogger.logQuery(event.query.sql);
91 }
92 },
93 }),
94 ClsModule.forRoot(cls.config),
95 OpenTelemetryModule.forRoot(otel),
96 ],
97 providers: [...repositories, AuthService, SchedulerRegistry],
98 }).compile();
99
100 this.app = await moduleFixture.createNestApplication().init();
101 }
102
103 async process(Repository: Repository) {
104 if (!this.app) {

Callers 13

runMethod · 0.95
onModuleInitMethod · 0.45
useSwaggerFunction · 0.45
onBootstrapMethod · 0.45
onConfigInitMethod · 0.45
FocusTrap.spec.tsFile · 0.45
AlbumCard.spec.tsFile · 0.45

Calls 6

getKyselyConfigFunction · 0.90
getEnvMethod · 0.80
compileMethod · 0.80
logQueryMethod · 0.80
logQueryErrorMethod · 0.80
initMethod · 0.45

Tested by

no test coverage detected