当前位置:网站首页>记一个 @nestjs/typeorm^8.1.4 版本不能获取.env选项问题
记一个 @nestjs/typeorm^8.1.4 版本不能获取.env选项问题
2022-07-06 01:08:00 【crayon-shin-chan】
1.简介
在 typeorm 中,本可以通过 .env文件来配置连接选项
但是在升级到 @nestjs/typeorm^8.1.4 typeorm^0.3.7后,就去掉了这个功能
2.解决
可以使用 ConnectionOptionsReader 来解决
import { ConnectionOptionsReader } from 'typeorm/connection/ConnectionOptionsReader'
TypeOrmModule.forRootAsync({
useFactory: async () => {
const reader = new ConnectionOptionsReader();
const options = await reader.all()
return options[0]
}
})
ConnectionOptionsReader 会在内部加载各种配置文件
边栏推荐
- Novice entry depth learning | 3-6: optimizer optimizers
- Installation and use of esxi
- Daily practice - February 13, 2022
- 孤勇者
- Questions about database: (5) query the barcode, location and reader number of each book in the inventory table
- 小程序容器可以发挥的价值
- C language programming (Chapter 6 functions)
- FFT 学习笔记(自认为详细)
- JMeter BeanShell的基本用法 一下语法只能在beanshell中使用
- Keepalive component cache does not take effect
猜你喜欢
IP storage and query in MySQL
Recoverable fuse characteristic test
Study diary: February 13, 2022
After 95, the CV engineer posted the payroll and made up this. It's really fragrant
可恢复保险丝特性测试
看抖音直播Beyond演唱会有感
程序员搞开源,读什么书最合适?
VSphere implements virtual machine migration
Exciting, 2022 open atom global open source summit registration is hot
Idea remotely submits spark tasks to the yarn cluster
随机推荐
Spark SQL null value, Nan judgment and processing
282. Stone consolidation (interval DP)
Pbootcms plug-in automatically collects fake original free plug-ins
详细页返回列表保留原来滚动条所在位置
Spark SQL UDF function
程序员成长第九篇:真实项目中的注意事项
Illustrated network: the principle behind TCP three-time handshake, why can't two-time handshake?
Development trend of Ali Taobao fine sorting model
Questions about database: (5) query the barcode, location and reader number of each book in the inventory table
Cglib dynamic agent -- example / principle
MCU realizes OTA online upgrade process through UART
小程序容器可以发挥的价值
Construction plan of Zhuhai food physical and chemical testing laboratory
How spark gets columns in dataframe --column, $, column, apply
Keepalive component cache does not take effect
[groovy] JSON string deserialization (use jsonslurper to deserialize JSON strings | construct related classes according to the map set)
ubantu 查看cudnn和cuda的版本
Dynamic programming -- linear DP
Recommended areas - ways to explore users' future interests
Spark AQE