Merge pull request 'eithan' (#19) from eithan into develop
Reviewed-on: #19
This commit was merged in pull request #19.
This commit is contained in:
@@ -3,11 +3,33 @@ import { TypeOrmModule } from '@nestjs/typeorm';
|
|||||||
import { AlumnosController } from './alumnos.controller';
|
import { AlumnosController } from './alumnos.controller';
|
||||||
import { AlumnosService } from './alumnos.service';
|
import { AlumnosService } from './alumnos.service';
|
||||||
import { RegistroAlumno } from './entities/registro-alumno.entity';
|
import { RegistroAlumno } from './entities/registro-alumno.entity';
|
||||||
|
import { ConfigService } from '@nestjs/config';
|
||||||
|
|
||||||
@Module({
|
@Module({
|
||||||
imports: [
|
imports: [
|
||||||
TypeOrmModule.forFeature([RegistroAlumno], 'alumnosConnection'),
|
TypeOrmModule.forFeature([RegistroAlumno], 'alumnosConnection'),
|
||||||
TypeOrmModule.forRoot({
|
|
||||||
|
|
||||||
|
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',
|
name: 'alumnosConnection',
|
||||||
type: 'mysql',
|
type: 'mysql',
|
||||||
host: process.env.ALUMNOS_DB_HOST ,
|
host: process.env.ALUMNOS_DB_HOST ,
|
||||||
@@ -17,7 +39,12 @@ import { RegistroAlumno } from './entities/registro-alumno.entity';
|
|||||||
database: process.env.ALUMNOS_DB_DATABASE ,
|
database: process.env.ALUMNOS_DB_DATABASE ,
|
||||||
entities: [RegistroAlumno],
|
entities: [RegistroAlumno],
|
||||||
synchronize: false,
|
synchronize: false,
|
||||||
}),
|
|
||||||
|
retryAttempts: 10, // Intentos para reconectar
|
||||||
|
retryDelay: 3000, // Tiempo entre reintentos
|
||||||
|
connectTimeout: 30000, // Timeout de conexión (30 segundos) │ │
|
||||||
|
|
||||||
|
}), */
|
||||||
],
|
],
|
||||||
controllers: [AlumnosController],
|
controllers: [AlumnosController],
|
||||||
providers: [AlumnosService],
|
providers: [AlumnosService],
|
||||||
|
|||||||
+3
-1
@@ -29,7 +29,9 @@ import { AlumnosModule } from './alumnos/alumnos.module';
|
|||||||
|
|
||||||
@Module({
|
@Module({
|
||||||
imports: [
|
imports: [
|
||||||
ConfigModule.forRoot(),
|
ConfigModule.forRoot({
|
||||||
|
isGlobal: true,
|
||||||
|
}),
|
||||||
TypeOrmModule.forRoot({
|
TypeOrmModule.forRoot({
|
||||||
|
|
||||||
type: 'mysql',
|
type: 'mysql',
|
||||||
|
|||||||
Reference in New Issue
Block a user