feat: 初始化项目
This commit is contained in:
@@ -0,0 +1,16 @@
|
||||
import { TypeOrmModuleOptions } from '@nestjs/typeorm';
|
||||
import { ConfigService } from '@nestjs/config';
|
||||
|
||||
export const getDatabaseConfig = (
|
||||
configService: ConfigService,
|
||||
): TypeOrmModuleOptions => ({
|
||||
type: 'postgres',
|
||||
host: configService.get('DB_HOST', 'localhost'),
|
||||
port: configService.get<number>('DB_PORT', 5432),
|
||||
username: configService.get('DB_USER'),
|
||||
password: configService.get('DB_PASSWORD'),
|
||||
database: configService.get('DB_DATABASE'),
|
||||
synchronize: configService.get('NODE_ENV') !== 'production',
|
||||
autoLoadEntities: true,
|
||||
logging: configService.get('NODE_ENV') === 'development',
|
||||
});
|
||||
Reference in New Issue
Block a user