Skip to content

Commit 9b614d4

Browse files
author
Gery Hirschfeld
authored
Merge pull request #18 from buuug7/master
add support for multiple connections in `ormconfig.[format]`.
2 parents 4524b69 + 8a1da91 commit 9b614d4

File tree

1 file changed

+8
-1
lines changed

1 file changed

+8
-1
lines changed

src/connection.ts

+8-1
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,13 @@ export const getConnectionOptions = async (configPath = 'ormconfig.js'): Promise
1717
}
1818

1919
export const createConnection = async (configPath: string): Promise<Connection> => {
20-
const options = await getConnectionOptions(configPath)
20+
let options = await getConnectionOptions(configPath)
21+
if (Array.isArray(options)) {
22+
options.forEach(item => {
23+
if (item.name === 'default') {
24+
options = item
25+
}
26+
})
27+
}
2128
return createTypeORMConnection(options as TypeORMConnectionOptions)
2229
}

0 commit comments

Comments
 (0)