I'm trying to connect my docker to NestJS using typeORM
database.module.ts
import { Module } from "@nestjs/common";
import { ConfigService } from "@nestjs/config";
import { TypeOrmModule } from "@nestjs/typeorm";
@Module({
imports:[
TypeOrmModule.forRootAsync({
useFactory:(configService:ConfigService)=>({
type: 'mysql',
host: configService.getOrThrow('MYSQL_HOST'),
port: configService.getOrThrow('MYSQL_PORT'),
database: configService.getOrThrow('MYSQL_DATABASE'),
username: configService.getOrThrow('MYSQL_USERNAME'),
password: configService.getOrThrow("MYSQL_PASSWORD"),
autoLoadEntities:true,
synchronize: configService.getOrThrow("MYSQL_SYNCHORIZED"),
}),
inject:[ConfigService],
}),
]
})
export class DatebaseModule{}
how can i configure my docker
MYSQL_HOST=mypassword
MYSQL_DATABASE=nestjs_typeorm
MYSQL_HOST=127.0.0.1
MYSQL_PORT=3306
MYSQL_USERNAME=root
MYSQL_PASSWORD=randomrootpassword
MYSQL_SYNCHORIZED=true