Skip to content

Commit

Permalink
Merge pull request #3 from watson-developer-cloud/stage1
Browse files Browse the repository at this point in the history
Promote stage1 to master
  • Loading branch information
germanattanasio authored Jan 20, 2020
2 parents da11d6b + 8a9e456 commit e86a8e4
Showing 1 changed file with 7 additions and 7 deletions.
14 changes: 7 additions & 7 deletions app.js
Original file line number Diff line number Diff line change
Expand Up @@ -17,15 +17,15 @@ let bearerToken = process.env.SPEECH_TO_TEXT_BEARER_TOKEN;
let username = process.env.SPEECH_TO_TEXT_USERNAME;
let password = process.env.SPEECH_TO_TEXT_PASSWORD;

// On Cloud Foundry, we'll have a VCAP_SERVICES environment variable with credentials.
let vcapCredentials = vcapServices.getCredentials('speech_to_text');

// Create appropriate token manager.
let tokenManager;
if (apikey) {
// If we're using IAM, it's possible that we're running on Cloud Foundry, where we need to look at the VCAP_SERVICES.
const vcapCredentials = vcapServices.getCredentials('speech_to_text');
if (vcapCredentials) {
apikey = vcapCredentials.apikey || apikey;
url = vcapCredentials.url || url;
}
if (vcapCredentials || apikey) {
// Choose credentials from VCAP if they exist.
apikey = (vcapCredentials && vcapCredentials.apikey) || apikey;
url = (vcapCredentials && vcapCredentials.url) || url;

try {
tokenManager = new IamTokenManager({ apikey });
Expand Down

0 comments on commit e86a8e4

Please sign in to comment.