muchos cambios :'v
This commit is contained in:
@@ -3,49 +3,9 @@ import { TypeOrmModule } from '@nestjs/typeorm';
|
||||
import { AlumnosController } from './alumnos.controller';
|
||||
import { AlumnosService } from './alumnos.service';
|
||||
import { RegistroAlumno } from './entities/registro-alumno.entity';
|
||||
import { ConfigService } from '@nestjs/config';
|
||||
|
||||
@Module({
|
||||
imports: [
|
||||
TypeOrmModule.forFeature([RegistroAlumno], 'alumnosConnection'),
|
||||
|
||||
|
||||
TypeOrmModule.forRootAsync({
|
||||
name: 'alumnosConnection',
|
||||
useFactory: (configService: ConfigService) => ({
|
||||
type: 'mysql',
|
||||
host: configService.get<string>('ALUMNOS_DB_HOST'),
|
||||
port: Number(configService.get<number>('ALUMNOS_DB_PORT')),
|
||||
username: configService.get<string>('ALUMNOS_DB_USERNAME'),
|
||||
password: configService.get<string>('ALUMNOS_DB_PASSWORD'),
|
||||
database: configService.get<string>('ALUMNOS_DB_DATABASE'),
|
||||
entities: [RegistroAlumno],
|
||||
synchronize: false,
|
||||
retryAttempts: 10,
|
||||
retryDelay: 3000,
|
||||
connectTimeout: 30000,
|
||||
}),
|
||||
inject: [ConfigService],
|
||||
}),
|
||||
|
||||
|
||||
/* TypeOrmModule.forRoot({
|
||||
name: 'alumnosConnection',
|
||||
type: 'mysql',
|
||||
host: process.env.ALUMNOS_DB_HOST ,
|
||||
port: Number(process.env.ALUMNOS_DB_PORT),
|
||||
username: process.env.ALUMNOS_DB_USERNAME ,
|
||||
password: process.env.ALUMNOS_DB_PASSWORD ,
|
||||
database: process.env.ALUMNOS_DB_DATABASE ,
|
||||
entities: [RegistroAlumno],
|
||||
synchronize: false,
|
||||
|
||||
retryAttempts: 10, // Intentos para reconectar
|
||||
retryDelay: 3000, // Tiempo entre reintentos
|
||||
connectTimeout: 30000, // Timeout de conexión (30 segundos) │ │
|
||||
|
||||
}), */
|
||||
],
|
||||
imports: [TypeOrmModule.forFeature([RegistroAlumno], 'alumnosConnection')],
|
||||
controllers: [AlumnosController],
|
||||
providers: [AlumnosService],
|
||||
exports: [AlumnosService],
|
||||
|
||||
Reference in New Issue
Block a user