mirror of
https://github.com/typeorm/typeorm.git
synced 2025-12-08 21:26:23 +00:00
feat(spanner): use credentials from connection options (#11492)
* #11442 * Npm Format * JSON Array update command Spanner - FIX * Revert "JSON Array update command Spanner - FIX" This reverts commit 56a28e575686dcee770b5601041b7d76e3a3a5e2.
This commit is contained in:
parent
2bfa300996
commit
07d7913be7
@ -16,4 +16,19 @@ export interface SpannerConnectionCredentialsOptions {
|
||||
* Database host port.
|
||||
*/
|
||||
readonly databaseId?: string
|
||||
|
||||
/**
|
||||
* Object containing client_email and private_key properties, or the external account client options. Cannot be used with apiKey.
|
||||
*/
|
||||
readonly credentials?: {
|
||||
/**
|
||||
* Client email connection credentials (Optional)
|
||||
*/
|
||||
readonly client_email: string
|
||||
|
||||
/**
|
||||
* Private key connection credentials (Optional)
|
||||
*/
|
||||
readonly private_key: string
|
||||
}
|
||||
}
|
||||
|
||||
@ -732,6 +732,16 @@ export class SpannerDriver implements Driver {
|
||||
protected loadDependencies(): void {
|
||||
try {
|
||||
const lib = this.options.driver || PlatformTools.load("spanner")
|
||||
|
||||
if (this.options.credentials) {
|
||||
this.spanner = new lib.Spanner({
|
||||
projectId: this.options.projectId,
|
||||
credentials: this.options.credentials,
|
||||
})
|
||||
|
||||
return
|
||||
}
|
||||
|
||||
this.spanner = new lib.Spanner({
|
||||
projectId: this.options.projectId,
|
||||
})
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user