Skip to content

Commit 82c331b

Browse files
committed
build(lambda): debug env
1 parent ff40d69 commit 82c331b

3 files changed

Lines changed: 22 additions & 17 deletions

File tree

src/app/database/database.module.ts

Lines changed: 19 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -13,21 +13,25 @@ import { EnvService } from '@/env/env.service';
1313
TypeOrmModule.forRootAsync({
1414
imports: [EnvModule],
1515
inject: [EnvService],
16-
useFactory: (env: EnvService) => ({
17-
type: 'mysql',
18-
host: env.get('DB_HOST'),
19-
port: env.get('DB_PORT'),
20-
database: env.get('DB_DATABASE'),
21-
username: env.get('DB_USERNAME'),
22-
password: env.get('DB_PASSWORD'),
23-
entities: [User, Patient, PatientSupport, Diagnostic],
24-
migrations: [__dirname + 'infra/database/migrations/**/*.ts'],
25-
synchronize: false,
26-
extra: {
27-
connectionLimit: 10,
28-
connectTimeout: 10000,
29-
},
30-
}),
16+
useFactory: (env: EnvService) => {
17+
console.log('EnvService inside TypeORM:', !!env);
18+
19+
return {
20+
type: 'mysql',
21+
host: env.get('DB_HOST'),
22+
port: env.get('DB_PORT'),
23+
database: env.get('DB_DATABASE'),
24+
username: env.get('DB_USERNAME'),
25+
password: env.get('DB_PASSWORD'),
26+
entities: [User, Patient, PatientSupport, Diagnostic],
27+
migrations: [__dirname + 'infra/database/migrations/**/*.ts'],
28+
synchronize: false,
29+
extra: {
30+
connectionLimit: 10,
31+
connectTimeout: 10000,
32+
},
33+
};
34+
},
3135
}),
3236
],
3337
})

src/app/main.ts

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,8 @@ import { HttpExceptionFilter } from '../utils/http.exception.filter';
88
import { AppModule } from './app.module';
99

1010
async function bootstrap(): Promise<void> {
11+
console.log(process.env.API_PORT);
12+
1113
const app = await NestFactory.create(AppModule);
1214

1315
app.useGlobalPipes(

src/env/env.module.ts

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,9 @@
11
import { Module } from '@nestjs/common';
2-
import { ConfigModule } from '@nestjs/config';
32

43
import { EnvService } from './env.service';
54

65
@Module({
7-
imports: [ConfigModule],
6+
imports: [],
87
providers: [EnvService],
98
exports: [EnvService],
109
})

0 commit comments

Comments
 (0)