@@ -68,8 +68,9 @@ function sessionToken(r) {
68
68
}
69
69
70
70
/**
71
- * Get the instance profile credentials needed to authenticate against Lambda from
72
- * a backend cache. If the credentials cannot be found, then return undefined.
71
+ * Get the instance profile credentials needed to authenticate against services
72
+ * in AWS such as S3 and Lambda from a backend cache. If the credentials cannot
73
+ * be found, then return undefined.
73
74
* @param r {Request} HTTP request object (not used, but required for NGINX configuration)
74
75
* @returns {undefined|{accessKeyId: (string), secretAccessKey: (string), sessionToken: (string|null), expiration: (string|null)} } AWS instance profile credentials or undefined
75
76
*/
@@ -363,14 +364,14 @@ async function _fetchEC2RoleCredentials() {
363
364
364
365
/**
365
366
* Get the credentials by assuming calling AssumeRoleWithWebIdentity with the environment variable
366
- * values ROLE_ARN, AWS_WEB_IDENTITY_TOKEN_FILE and HOSTNAME
367
+ * values ROLE_ARN, AWS_WEB_IDENTITY_TOKEN_FILE and AWS_ROLE_SESSION_NAME.
367
368
*
368
369
* @returns {Promise<{accessKeyId: (string), secretAccessKey: (string), sessionToken: (string), expiration: (string)}> }
369
370
* @private
370
371
*/
371
372
async function _fetchWebIdentityCredentials ( r ) {
372
373
const arn = process . env [ 'AWS_ROLE_ARN' ] ;
373
- const name = process . env [ 'HOSTNAME' ] || 'nginx-lambda-gateway' ;
374
+ const name = process . env [ 'AWS_ROLE_SESSION_NAME' ] ;
374
375
375
376
let sts_endpoint = process . env [ 'STS_ENDPOINT' ] ;
376
377
if ( ! sts_endpoint ) {
@@ -426,12 +427,12 @@ async function _fetchWebIdentityCredentials(r) {
426
427
*
427
428
* @returns {Date } The current moment as a timestamp
428
429
*/
429
- function getNow ( ) {
430
+ function Now ( ) {
430
431
return NOW ;
431
432
}
432
433
433
434
export default {
434
- getNow ,
435
+ Now ,
435
436
fetchCredentials,
436
437
readCredentials,
437
438
sessionToken,
0 commit comments