Skip to content

Commit

Permalink
Fixed ADC auth
Browse files Browse the repository at this point in the history
  • Loading branch information
ahiipsa committed Sep 21, 2023
1 parent dd729dd commit 6063e99
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 7 deletions.
5 changes: 1 addition & 4 deletions src/config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -147,8 +147,5 @@ export default {
username: process.env.ES_USERNAME ?? '',
password: process.env.ES_PASSWORD ?? ''
},
gc: {
projectId: process.env.GC_PROJECT_ID,
projectKey: process.env.GC_PROJECT_KEY ?? ''
}
gc: { credentials: process.env.GC_CREDENTIALS ?? '' }
}
5 changes: 2 additions & 3 deletions src/modules/voice-translate/client.ts
Original file line number Diff line number Diff line change
@@ -1,9 +1,8 @@
import GcTextToSpeech from '@google-cloud/text-to-speech'
import config from '../../config'

const projectKey = Buffer.from(config.gc.projectKey).toString('utf-8')

const client = new GcTextToSpeech.TextToSpeechClient({ key: projectKey })
const credentials = JSON.parse(Buffer.from(config.gc.credentials, 'base64').toString('utf-8'))
const client = new GcTextToSpeech.TextToSpeechClient({ credentials })

export async function textToSpeech (text: string): Promise<string | Uint8Array | null | undefined> {
const ssml = `<speak>${text}</speak>`
Expand Down

0 comments on commit 6063e99

Please sign in to comment.