Unable to use async config
See original GitHub issueIssue type:
[x] question [ ] bug report [x] feature request [ ] documentation issue
Database system/driver:
[ ] cordova
[ ] mongodb
[ ] mssql
[ ] mysql
/ mariadb
[ ] oracle
[x] postgres
[ ] sqlite
[ ] sqljs
[ ] react-native
[ ] expo
TypeORM version:
[x] latest
[x] @next
[ ] 0.x.x
(or put your version here)
Steps to reproduce or a small repository showing the problem:
It seems that currently it is impossible to have ormconfig.js
(required by cli tools to operate) to return credentials asynchronously. In case when actual credentials are not in env, but rather need to be fetched from network (e.g. from Vault, AWS SSM, etc.), it is currently impossible to have await/async
in ormconfig.js
and return value for cli tools to operate.
It seems that even simple await require( 'ormconfig' )
kind of code would solve the problem (and fall back to current behaior in case of sync config.
Issue Analytics
- State:
- Created 5 years ago
- Reactions:1
- Comments:7 (2 by maintainers)
What’s new there ?
Same problem with MYSQL !
I’m using
ts-node
, but it should be doable with plain js. I’ll take a guess:You can also do this with plain promises: