Skip to content

Commit

Permalink
Remove apiKey from GCP config if credential exists
Browse files Browse the repository at this point in the history
  • Loading branch information
llun committed Aug 20, 2024
1 parent add02f4 commit e019b08
Showing 1 changed file with 7 additions and 1 deletion.
8 changes: 7 additions & 1 deletion lib/storage/firestore.ts
Original file line number Diff line number Diff line change
Expand Up @@ -117,7 +117,13 @@ export class FirestoreStorage implements Storage {
if (process.env.FIREBASE_PRIVATE_KEY && config.credentials) {
config.credentials.private_key = process.env.FIREBASE_PRIVATE_KEY
}
this.db = new Firestore(config)
if (config.credentials) {
const { apiKey, ...rest } = config
this.db = new Firestore(rest)
} else {
this.db = new Firestore(config)
}

this.config = config
}

Expand Down

0 comments on commit e019b08

Please sign in to comment.