diff --git a/lib/routes/api/speech-credentials.js b/lib/routes/api/speech-credentials.js index fd6305f..da364b2 100644 --- a/lib/routes/api/speech-credentials.js +++ b/lib/routes/api/speech-credentials.js @@ -58,6 +58,7 @@ router.post('/', async(req, res) => { access_key_id, secret_access_key }); + logger.info({data}, 'creating aws speech credential'); encrypted_credential = encrypt(data); } else if (vendor === 'microsoft') { @@ -65,6 +66,7 @@ router.post('/', async(req, res) => { region, api_key }); + logger.info({data}, 'creating azure speech credential'); encrypted_credential = encrypt(data); } else if (vendor === 'wellsaid') { @@ -104,21 +106,23 @@ router.get('/', async(req, res) => { res.status(200).json(creds.map((c) => { const {credential, ...obj} = c; if ('google' === obj.vendor) { - obj.service_key = decrypt(credential); + obj.service_key = JSON.parse(decrypt(credential)); } else if ('aws' === obj.vendor) { - const o = decrypt(credential); + const o = JSON.parse(decrypt(credential)); obj.access_key_id = o.access_key_id; obj.secret_access_key = o.secret_access_key; obj.aws_region = o.aws_region; + logger.info({obj, o}, 'retrieving aws speech credential'); } else if ('microsoft' === obj.vendor) { - const o = decrypt(credential); + const o = JSON.parse(decrypt(credential)); obj.api_key = o.api_key; obj.region = o.region; + logger.info({obj, o}, 'retrieving azure speech credential'); } else if ('wellsaid' === obj.vendor) { - const o = decrypt(credential); + const o = JSON.parse(decrypt(credential)); obj.api_key = o.api_key; } return obj;