Skip to content

Commit f8ce27c

Browse files
committed
Add injection point for edgedb connection options
1 parent fa67117 commit f8ce27c

File tree

1 file changed

+12
-3
lines changed

1 file changed

+12
-3
lines changed

src/core/edgedb/edgedb.module.ts

Lines changed: 12 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
import { Module, OnModuleDestroy } from '@nestjs/common';
22
import { APP_INTERCEPTOR } from '@nestjs/core';
3-
import { createClient, Duration } from 'edgedb';
3+
import { ConnectOptions, createClient, Duration } from 'edgedb';
44
import { IdResolver } from '~/common/validators/short-id.validator';
55
import type { ConfigService } from '~/core';
66
import { splitDb } from '../database/split-db.provider';
@@ -30,13 +30,22 @@ import { TransactionContext } from './transaction.context';
3030
}),
3131
},
3232
OptionsContext,
33+
{
34+
provide: 'EDGEDB_CONNECT',
35+
useValue: {} satisfies ConnectOptions,
36+
},
3337
{
3438
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+
) => {
3745
const client = createClient({
3846
// Only for connection retry warnings. Skip.
3947
logging: false,
48+
...connectConfig,
4049
});
4150

4251
Object.assign(client, { options: options.currentAsLazyRef });

0 commit comments

Comments
 (0)