File tree Expand file tree Collapse file tree 1 file changed +6
-2
lines changed
Expand file tree Collapse file tree 1 file changed +6
-2
lines changed Original file line number Diff line number Diff line change 11import { MicroframeworkLoader , MicroframeworkSettings } from 'microframework-w3tec' ;
2- import { createConnection } from 'typeorm' ;
2+ import { createConnection , getConnectionOptions } from 'typeorm' ;
33
44import { env } from '../env' ;
55
66export const typeormLoader : MicroframeworkLoader = async ( settings : MicroframeworkSettings | undefined ) => {
77
8- const connection = await createConnection ( {
8+ const loadedConnectionOptions = await getConnectionOptions ( ) ;
9+
10+ const connectionOptions = Object . assign ( loadedConnectionOptions , {
911 type : env . db . type as any , // See createConnection options for valid types
1012 host : env . db . host ,
1113 port : env . db . port ,
@@ -18,6 +20,8 @@ export const typeormLoader: MicroframeworkLoader = async (settings: Microframewo
1820 migrations : env . app . dirs . migrations ,
1921 } ) ;
2022
23+ const connection = await createConnection ( connectionOptions ) ;
24+
2125 if ( settings ) {
2226 settings . setData ( 'connection' , connection ) ;
2327 settings . onShutdown ( ( ) => connection . close ( ) ) ;
You can’t perform that action at this time.
0 commit comments