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:
Denes Antonio de Souza 2025-06-04 17:55:12 -03:00 committed by GitHub
parent 2bfa300996
commit 07d7913be7
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
2 changed files with 25 additions and 0 deletions

View File

@ -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
}
}

View File

@ -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,
})