当前位置:网站首页>记一个 @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 会在内部加载各种配置文件
边栏推荐
- Gartner released the prediction of eight major network security trends from 2022 to 2023. Zero trust is the starting point and regulations cover a wider range
- Fibonacci number
- GNSS terminology
- The population logic of the request to read product data on the sap Spartacus home page
- 关于softmax函数的见解
- Four dimensional matrix, flip (including mirror image), rotation, world coordinates and local coordinates
- Leetcode 44 Wildcard matching (2022.02.13)
- Opinions on softmax function
- Dedecms plug-in free SEO plug-in summary
- Spark AQE
猜你喜欢
MYSQL GROUP_ The concat function realizes the content merging of the same ID
2020.2.13
Keepalive component cache does not take effect
有谁知道 达梦数据库表的列的数据类型 精度怎么修改呀
Leetcode study - day 35
The growth path of test / development programmers, the problem of thinking about the overall situation
Cf:c. the third problem
1791. Find the central node of the star diagram / 1790 Can two strings be equal by performing string exchange only once
ADS-NPU芯片架构设计的五大挑战
SSH login is stuck and disconnected
随机推荐
[groovy] XML serialization (use markupbuilder to generate XML data | set XML tag content | set XML tag attributes)
Logstash clear sincedb_ Path upload records and retransmit log data
Cglib dynamic agent -- example / principle
VSphere implements virtual machine migration
Intensive learning weekly, issue 52: depth cuprl, distspectrl & double deep q-network
devkit入门
Recursive method converts ordered array into binary search tree
FFT learning notes (I think it is detailed)
MYSQL GROUP_ The concat function realizes the content merging of the same ID
Ubantu check cudnn and CUDA versions
GNSS terminology
Illustrated network: the principle behind TCP three-time handshake, why can't two-time handshake?
ADS-NPU芯片架构设计的五大挑战
Obstacle detection
Dynamic programming -- linear DP
Four commonly used techniques for anti aliasing
BiShe - College Student Association Management System Based on SSM
Construction plan of Zhuhai food physical and chemical testing laboratory
Interview must brush algorithm top101 backtracking article top34
Starting from 1.5, build a micro Service Framework - call chain tracking traceid