All files / src/modules/common/database/mongo/auth auth.provider.ts

0% Statements 0/7
100% Branches 0/0
0% Functions 0/1
0% Lines 0/7

Press n or j to go to the next uncovered block, b, p or k for the previous block.

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22                                           
import { connect } from 'mongoose';
import ENV from '../../../../../shared/env';
import { MONGO_AUTH_TOKEN } from '../../shared/database.const';
import { getConnectionString } from '../shared/mongo.utils';
 
export const authConnectionString = getConnectionString({
  host: ENV.MONGODB.AUTH.HOST,
  port: ENV.MONGODB.AUTH.PORT,
  username: ENV.MONGODB.AUTH.USERNAME,
  password: ENV.MONGODB.AUTH.PASSWORD,
  database: ENV.MONGODB.AUTH.DATABASE,
});
 
export const AuthDatabaseProvider = {
  provide: MONGO_AUTH_TOKEN,
  useFactory: () =>
    connect(authConnectionString, {
      autoIndex: false,
      directConnection: ENV.MONGODB.AUTH.DIRECT_CONNECTION,
    }),
};