Skip to content

Commit

Permalink
Merge pull request #18 from buuug7/master
Browse files Browse the repository at this point in the history
add support for multiple connections in `ormconfig.[format]`.
  • Loading branch information
Gery Hirschfeld authored Mar 25, 2020
2 parents 4524b69 + 8a1da91 commit 9b614d4
Showing 1 changed file with 8 additions and 1 deletion.
9 changes: 8 additions & 1 deletion src/connection.ts
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,13 @@ export const getConnectionOptions = async (configPath = 'ormconfig.js'): Promise
}

export const createConnection = async (configPath: string): Promise<Connection> => {
const options = await getConnectionOptions(configPath)
let options = await getConnectionOptions(configPath)
if (Array.isArray(options)) {
options.forEach(item => {
if (item.name === 'default') {
options = item
}
})
}
return createTypeORMConnection(options as TypeORMConnectionOptions)
}

0 comments on commit 9b614d4

Please sign in to comment.