Skip to content

Commit

Permalink
test-2
Browse files Browse the repository at this point in the history
  • Loading branch information
wlstmd committed Aug 26, 2024
1 parent 9615982 commit d4650d9
Showing 1 changed file with 24 additions and 10 deletions.
34 changes: 24 additions & 10 deletions backend/src/app.module.ts
Original file line number Diff line number Diff line change
Expand Up @@ -14,16 +14,30 @@ import { FileModule } from './file/file.module';
ConfigModule.forRoot({ isGlobal: true }),
TypeOrmModule.forRootAsync({
imports: [ConfigModule],
useFactory: (configService: ConfigService) => ({
type: 'mysql',
host: configService.get<string>('DB_HOST'),
port: configService.get<number>('DB_HOST'),
username: configService.get<string>('DB_USERNAME'),
password: configService.get<string>('DB_PASSWORD'),
database: configService.get<string>('DB_DATABASE'),
entities: [__dirname + '/**/*.entity.{js,ts}'],
synchronize: true,
}),
useFactory: (configService: ConfigService) => {
const dbHost = configService.get<string>('DB_HOST');
const dbPort = configService.get<number>('DB_PORT');
const dbUsername = configService.get<string>('DB_USERNAME');
const dbPassword = configService.get<string>('DB_PASSWORD');
const dbDatabase = configService.get<string>('DB_DATABASE');

console.log('DB_HOST:', dbHost);
console.log('DB_PORT:', dbPort);
console.log('DB_USERNAME:', dbUsername);
console.log('DB_PASSWORD:', dbPassword);
console.log('DB_DATABASE:', dbDatabase);

return {
type: 'mysql',
host: dbHost,
port: dbPort,
username: dbUsername,
password: dbPassword,
database: dbDatabase,
entities: [__dirname + '/**/*.entity.{js,ts}'],
synchronize: true,
};
},
inject: [ConfigService],
}),
AuthModule,
Expand Down

0 comments on commit d4650d9

Please sign in to comment.