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

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

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 23 24 25 26 27 28 29 30                                                           
import ENV from 'src/shared/env';
import { DataSource } from 'typeorm';
import { DatabaseDomain, POSTGRES_AUTH_TOKEN } from '../../shared/database.const';
 
export const AuthDataSource = new DataSource({
  type: 'postgres',
  name: DatabaseDomain.Auth,
  host: ENV.POSTGRES.AUTH.HOST,
  port: ENV.POSTGRES.AUTH.PORT,
  username: ENV.POSTGRES.AUTH.USERNAME,
  password: ENV.POSTGRES.AUTH.PASSWORD,
  database: ENV.POSTGRES.AUTH.DATABASE,
  schema: ENV.POSTGRES.AUTH.SCHEMA,
  synchronize: false,
  migrationsTableName: 'migrations',
  migrations: [__dirname + '/migrations/*{.ts,.js}'],
  migrationsRun: ENV.POSTGRES.AUTH.MIGRATIONS_RUN,
  migrationsTransactionMode: 'each',
  logger: 'advanced-console',
  connectTimeoutMS: ENV.POSTGRES.AUTH.CONNECTION_TIMEOUT,
  maxQueryExecutionTime: ENV.POSTGRES.AUTH.MAX_QUERY_EXECUTION_TIME,
  poolSize: ENV.POSTGRES.AUTH.POOL_SIZE,
  entities: [__dirname + '/schemas/*{.ts,.js}'],
});
 
export const AuthDatabaseProvider = {
  provide: POSTGRES_AUTH_TOKEN,
  useFactory: () => AuthDataSource,
};