|
1 | 1 | import { Module, OnModuleDestroy } from '@nestjs/common';
|
2 | 2 | import { APP_INTERCEPTOR } from '@nestjs/core';
|
3 |
| -import { createClient, Duration } from 'edgedb'; |
| 3 | +import { ConnectOptions, createClient, Duration } from 'edgedb'; |
4 | 4 | import { IdResolver } from '~/common/validators/short-id.validator';
|
5 | 5 | import type { ConfigService } from '~/core';
|
6 | 6 | import { splitDb } from '../database/split-db.provider';
|
@@ -30,13 +30,22 @@ import { TransactionContext } from './transaction.context';
|
30 | 30 | }),
|
31 | 31 | },
|
32 | 32 | OptionsContext,
|
| 33 | + { |
| 34 | + provide: 'EDGEDB_CONNECT', |
| 35 | + useValue: {} satisfies ConnectOptions, |
| 36 | + }, |
33 | 37 | {
|
34 | 38 | provide: Client,
|
35 |
| - inject: [OptionsContext, 'CONFIG'], |
36 |
| - useFactory: async (options: OptionsContext, config: ConfigService) => { |
| 39 | + inject: [OptionsContext, 'EDGEDB_CONNECT', 'CONFIG'], |
| 40 | + useFactory: async ( |
| 41 | + options: OptionsContext, |
| 42 | + connectConfig: ConnectOptions, |
| 43 | + config: ConfigService, |
| 44 | + ) => { |
37 | 45 | const client = createClient({
|
38 | 46 | // Only for connection retry warnings. Skip.
|
39 | 47 | logging: false,
|
| 48 | + ...connectConfig, |
40 | 49 | });
|
41 | 50 |
|
42 | 51 | Object.assign(client, { options: options.currentAsLazyRef });
|
|
0 commit comments