From d2c90c8b20740aa02c17cc98c1e42708567ff1c6 Mon Sep 17 00:00:00 2001 From: Cedric Godin Date: Mon, 5 Feb 2018 12:54:46 -0500 Subject: [PATCH] Added API key in code --- resources/js/speech-to-text.js | 5 ++++- stream-to-text.js | 4 +++- 2 files changed, 7 insertions(+), 2 deletions(-) diff --git a/resources/js/speech-to-text.js b/resources/js/speech-to-text.js index 9cfbb3d..a77243d 100644 --- a/resources/js/speech-to-text.js +++ b/resources/js/speech-to-text.js @@ -1,7 +1,10 @@ const fs = require('fs'); const speech = require('@google-cloud/speech'); -const client = new speech.SpeechClient(); +const client = new speech.SpeechClient({ + keyFilename: 'google-api-key.json' +}); + const languageCode = "fr-CA"; exports.setLanguage = function(code) { diff --git a/stream-to-text.js b/stream-to-text.js index 04dbf0a..09bdf0c 100644 --- a/stream-to-text.js +++ b/stream-to-text.js @@ -1,7 +1,9 @@ const EventEmitter = require('events'); const speech = require('@google-cloud/speech'); -const client = new speech.SpeechClient(); +const client = new speech.SpeechClient({ + keyFilename: 'google-api-key.json' +}); const languageCode = "fr-CA"; -- 2.34.1