2024-06-05 00:23:18 -06:00
|
|
|
import { Module } from '@nestjs/common';
|
2024-06-05 22:36:29 -06:00
|
|
|
import { ConfigModule, ConfigService } from '@nestjs/config';
|
2024-06-05 00:23:18 -06:00
|
|
|
import { AppController } from './app.controller';
|
|
|
|
|
import { AppService } from './app.service';
|
2024-06-05 14:35:05 -06:00
|
|
|
import { AuthModule } from './auth/auth.module';
|
|
|
|
|
import { UsersModule } from './users/users.module';
|
2024-06-05 22:36:29 -06:00
|
|
|
import { TypeOrmModule } from '@nestjs/typeorm';
|
2024-06-11 02:31:33 -06:00
|
|
|
import { User } from "./users/entities/user.entity";
|
2024-06-05 00:23:18 -06:00
|
|
|
|
|
|
|
|
@Module({
|
2024-06-05 22:36:29 -06:00
|
|
|
imports: [
|
2024-06-06 21:21:58 -06:00
|
|
|
AuthModule,
|
|
|
|
|
UsersModule,
|
2024-06-05 22:36:29 -06:00
|
|
|
ConfigModule.forRoot({
|
2024-06-06 21:21:58 -06:00
|
|
|
envFilePath: '.env',
|
2024-06-05 22:36:29 -06:00
|
|
|
isGlobal: true,
|
2024-06-06 21:21:58 -06:00
|
|
|
}),
|
|
|
|
|
TypeOrmModule.forRootAsync({
|
|
|
|
|
imports: [ConfigModule],
|
|
|
|
|
inject: [ConfigService],
|
|
|
|
|
useFactory: async (configservice: ConfigService) => ({
|
|
|
|
|
type: 'mariadb',
|
|
|
|
|
host: configservice.get('DB_HOST'),
|
|
|
|
|
port: configservice.get('DB_PORT'),
|
|
|
|
|
username: configservice.get('DB_USER'),
|
|
|
|
|
password: configservice.get('DB_PASSWORD'),
|
|
|
|
|
database: configservice.get('DB_DATABASE'),
|
2024-06-11 02:31:33 -06:00
|
|
|
entities: [User],
|
2024-06-06 21:21:58 -06:00
|
|
|
synchronize: configservice.get('DB_SYNCRONIZE'),
|
|
|
|
|
}),
|
|
|
|
|
}),
|
|
|
|
|
],
|
2024-06-06 20:32:46 -06:00
|
|
|
controllers: [AppController],
|
|
|
|
|
providers: [AppService],
|
2024-06-05 00:23:18 -06:00
|
|
|
})
|
|
|
|
|
export class AppModule {}
|