diff --git a/libs/dal/src/dal.service.ts b/libs/dal/src/dal.service.ts index ed1c5bfd6e0..348f02c8e23 100644 --- a/libs/dal/src/dal.service.ts +++ b/libs/dal/src/dal.service.ts @@ -1,4 +1,5 @@ import mongoose, { Connection, ConnectOptions } from 'mongoose'; +import { AuthMechanism } from './types'; export const baseConfig: ConnectOptions = { // AUTO_CREATE_INDEXES is deprecated, use MONGO_AUTO_CREATE_INDEXES @@ -6,6 +7,7 @@ export const baseConfig: ConnectOptions = { maxIdleTimeMS: process.env.MONGO_MAX_IDLE_TIME_IN_MS ? Number(process.env.MONGO_MAX_IDLE_TIME_IN_MS) : 1000 * 30, maxPoolSize: process.env.MONGO_MAX_POOL_SIZE ? Number(process.env.MONGO_MAX_POOL_SIZE) : 50, minPoolSize: process.env.MONGO_MIN_POOL_SIZE ? Number(process.env.MONGO_MIN_POOL_SIZE) : 10, + authMechanism: (process.env.MONGO_AUTH_MECHANISM as AuthMechanism) || ('DEFAULT' as AuthMechanism), }; export class DalService { diff --git a/libs/dal/src/types/auth.ts b/libs/dal/src/types/auth.ts new file mode 100644 index 00000000000..050606a3d52 --- /dev/null +++ b/libs/dal/src/types/auth.ts @@ -0,0 +1,8 @@ +export type AuthMechanism = + | 'DEFAULT' + | 'MONGODB-CR' + | 'SCRAM-SHA-1' + | 'SCRAM-SHA-256' + | 'MONGODB-X509' + | 'GSSAPI' + | 'PLAIN'; diff --git a/libs/dal/src/types/index.ts b/libs/dal/src/types/index.ts index e05844d67f1..675e31f3453 100644 --- a/libs/dal/src/types/index.ts +++ b/libs/dal/src/types/index.ts @@ -2,3 +2,4 @@ export * from './enforce'; export * from './helpers'; export * from './results'; export * from './error.enum'; +export * from './auth';