mirror of
https://github.com/farcasclaudiu/Flowise.git
synced 2026-06-23 05:00:23 +03:00
Bugfix/Prevent open connections on typeorm datasource (#3652)
prevent open connections on typeorm datasource
This commit is contained in:
@@ -21,6 +21,13 @@ export class MySQLSaver extends BaseCheckpointSaver implements MemoryMethods {
|
||||
|
||||
private async getDataSource(): Promise<DataSource> {
|
||||
const { datasourceOptions } = this.config
|
||||
if (!datasourceOptions) {
|
||||
throw new Error('No datasource options provided')
|
||||
}
|
||||
// Prevent using default Postgres port, otherwise will throw uncaught error and crashing the app
|
||||
if (datasourceOptions.port === 5432) {
|
||||
throw new Error('Invalid port number')
|
||||
}
|
||||
const dataSource = new DataSource(datasourceOptions)
|
||||
await dataSource.initialize()
|
||||
return dataSource
|
||||
|
||||
Reference in New Issue
Block a user