This repository was archived by the owner on Nov 27, 2025. It is now read-only.
Description code:
const { BearerTokenAuthenticator, CloudPakForDataAuthenticator } = require("ibm-cloud-sdk-core");
let tts;
const watsonInfo = io.config.get('watson') || null;
console.log('watsonInfo is: ' + JSON.stringify(watsonInfo));
if (watsonInfo && watsonInfo.environment == 'cloudpak') {
logger.info('environment is cloudpak (token)');
tts = new TextToSpeechV1({
authenticator: new BearerTokenAuthenticator({
bearerToken: watsonInfo.bearerToken,
}),
disableSslVerification: true,
serviceUrl: watsonInfo.ttsURL,
});
}
else if (watsonInfo && watsonInfo.environment == "cloudpak-user-pass") {
logger.info('environment is cloudpak-user-pass');
tts = new TextToSpeechV1({
authenticator: new CloudPakForDataAuthenticator({
username: watsonInfo.username,
password: watsonInfo.password,
disableSslVerification: true,
url: watsonInfo.ttsUserPassURL + '/icp4d-api'
}),
disableSslVerification: true,
serviceUrl: watsonInfo.ttsUserPassURL + watsonInfo.ttsUserPassPath
});
}
else {
logger.info('environment is ibmcloud');
tts = new TextToSpeechV1({});
}
Reactions are currently unavailable
code: