mirror of
https://github.com/jambonz/speech-utils.git
synced 2025-12-19 03:37:49 +00:00
wip
This commit is contained in:
@@ -5,17 +5,17 @@ const EXPIRY = 3600;
|
||||
|
||||
async function getAwsAuthToken(
|
||||
logger, createHash, retrieveHash,
|
||||
{accessKeyId, secretAccessKey, region, RoleArn}) {
|
||||
{accessKeyId, secretAccessKey, region, roleArn}) {
|
||||
logger = logger || noopLogger;
|
||||
try {
|
||||
const key = makeAwsKey(RoleArn || accessKeyId);
|
||||
const key = makeAwsKey(roleArn || accessKeyId);
|
||||
const obj = await retrieveHash(key);
|
||||
if (obj) return {...obj, servedFromCache: true};
|
||||
|
||||
let data;
|
||||
if (RoleArn) {
|
||||
if (roleArn) {
|
||||
const stsClient = new STSClient({ region });
|
||||
const roleToAssume = { RoleArn, RoleSessionName: 'Jambonz_Speech', DurationSeconds: EXPIRY};
|
||||
const roleToAssume = { RoleArn: roleArn, RoleSessionName: 'Jambonz_Speech', DurationSeconds: EXPIRY};
|
||||
const command = new AssumeRoleCommand(roleToAssume);
|
||||
|
||||
data = await stsClient.send(command);
|
||||
|
||||
@@ -111,7 +111,7 @@ const getAwsVoices = async(_client, createHash, retrieveHash, logger, credential
|
||||
logger, createHash, retrieveHash,
|
||||
{
|
||||
region,
|
||||
RoleArn: roleArn
|
||||
roleArn
|
||||
}),
|
||||
});
|
||||
} else {
|
||||
|
||||
@@ -285,7 +285,7 @@ const synthPolly = async(createHash, retrieveHash, logger,
|
||||
logger, createHash, retrieveHash,
|
||||
{
|
||||
region,
|
||||
RoleArn: roleArn
|
||||
roleArn
|
||||
}),
|
||||
});
|
||||
} else {
|
||||
|
||||
Reference in New Issue
Block a user