当前位置:网站首页>记一个 @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 会在内部加载各种配置文件
边栏推荐
- Dynamic programming -- linear DP
- The inconsistency between the versions of dynamic library and static library will lead to bugs
- MobileNet系列(5):使用pytorch搭建MobileNetV3并基于迁移学习训练
- Development trend of Ali Taobao fine sorting model
- Fibonacci number
- Idea remotely submits spark tasks to the yarn cluster
- 看抖音直播Beyond演唱会有感
- [groovy] compile time meta programming (compile time method interception | method interception in myasttransformation visit method)
- Four commonly used techniques for anti aliasing
- 详细页返回列表保留原来滚动条所在位置
猜你喜欢
1791. Find the central node of the star diagram / 1790 Can two strings be equal by performing string exchange only once
cf:H. Maximal AND【位运算练习 + k次操作 + 最大And】
关于#数据库#的问题:(5)查询库存表中每本书的条码、位置和借阅的读者编号
Spark SQL null value, Nan judgment and processing
esxi的安装和使用
程序员搞开源,读什么书最合适?
Mobilenet series (5): use pytorch to build mobilenetv3 and learn and train based on migration
猿桌派第三季开播在即,打开出海浪潮下的开发者新视野
vSphere实现虚拟机迁移
cf:D. Insert a Progression【关于数组中的插入 + 绝对值的性质 + 贪心一头一尾最值】
随机推荐
FFT learning notes (I think it is detailed)
1791. Find the central node of the star diagram / 1790 Can two strings be equal by performing string exchange only once
The third season of ape table school is about to launch, opening a new vision for developers under the wave of going to sea
Dede collection plug-in free collection release push plug-in
Cve-2017-11882 reappearance
可恢复保险丝特性测试
有谁知道 达梦数据库表的列的数据类型 精度怎么修改呀
朝招金安全吗 会不会亏损本金
How spark gets columns in dataframe --column, $, column, apply
Live broadcast system code, custom soft keyboard style: three kinds of switching: letters, numbers and punctuation
Live video source code, realize local storage of search history
The inconsistency between the versions of dynamic library and static library will lead to bugs
Development trend of Ali Taobao fine sorting model
Spark DF adds a column
图解网络:TCP三次握手背后的原理,为啥两次握手不可以?
[simple implementation of file IO]
Is chaozhaojin safe? Will it lose its principal
golang mqtt/stomp/nats/amqp
Lone brave man
关于#数据库#的问题:(5)查询库存表中每本书的条码、位置和借阅的读者编号