Skip to content

Commit 6e1bd8d

Browse files
committed
Don't try to connect to edgedb instance if that's not the chosen database engine
1 parent 951dde2 commit 6e1bd8d

File tree

1 file changed

+6
-3
lines changed

1 file changed

+6
-3
lines changed

src/core/edgedb/edgedb.module.ts

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
import { Module, OnModuleDestroy } from '@nestjs/common';
22
import { APP_INTERCEPTOR } from '@nestjs/core';
33
import { createClient, Duration } from 'edgedb';
4+
import type { ConfigService } from '~/core';
45
import { codecs, registerCustomScalarCodecs } from './codecs';
56
import { EdgeDBTransactionalMutationsInterceptor } from './edgedb-transactional-mutations.interceptor';
67
import { EdgeDB } from './edgedb.service';
@@ -26,16 +27,18 @@ import { TransactionContext } from './transaction.context';
2627
OptionsContext,
2728
{
2829
provide: Client,
29-
inject: [OptionsContext],
30-
useFactory: async (options: OptionsContext) => {
30+
inject: [OptionsContext, 'CONFIG'],
31+
useFactory: async (options: OptionsContext, config: ConfigService) => {
3132
const client = createClient({
3233
// Only for connection retry warnings. Skip.
3334
logging: false,
3435
});
3536

3637
Object.assign(client, { options: options.current });
3738

38-
await registerCustomScalarCodecs(client, codecs);
39+
if (config.databaseEngine === 'edgedb') {
40+
await registerCustomScalarCodecs(client, codecs);
41+
}
3942

4043
return client;
4144
},

0 commit comments

Comments
 (0)