Bugfix/Prevent open connections on typeorm datasource (#3652)

prevent open connections on typeorm datasource
This commit is contained in:
Henry Heng
2024-12-08 21:06:07 +00:00
committed by GitHub
parent 680fe8dee1
commit ddca80d4e0
7 changed files with 249 additions and 82 deletions
@@ -33,6 +33,11 @@ export class PGVectorDriver extends VectorStoreDriver {
password: password,
database: this.getDatabase()
}
// Prevent using default MySQL port, otherwise will throw uncaught error and crashing the app
if (this.getHost() === '3006') {
throw new Error('Invalid port number')
}
}
return this._postgresConnectionOptions
@@ -34,6 +34,11 @@ export class TypeORMDriver extends VectorStoreDriver {
password: password,
database: this.getDatabase()
} as DataSourceOptions
// Prevent using default MySQL port, otherwise will throw uncaught error and crashing the app
if (this.getHost() === '3006') {
throw new Error('Invalid port number')
}
}
return this._postgresConnectionOptions
}