@@ -160,8 +160,8 @@ function _credentialsTempFile() {
160
160
* @param credentials {{accessKeyId: (string), secretAccessKey: (string), sessionToken: (string), expiration: (string)}} AWS instance profile credentials
161
161
*/
162
162
function writeCredentials ( r , credentials ) {
163
- // Do not bother writing credentials if we are running in a mode where we
164
- // do not need instance credentials.
163
+ /* Do not bother writing credentials if we are running in a mode where we
164
+ do not need instance credentials. */
165
165
if ( process . env [ 'S3_ACCESS_KEY_ID' ] && process . env [ 'S3_SECRET_KEY' ] ) {
166
166
return ;
167
167
}
@@ -205,7 +205,7 @@ function _writeCredentialsToFile(credentials) {
205
205
* Get the instance profile credentials needed to authenticated against S3 from
206
206
* a backend cache. If the credentials cannot be found, then return undefined.
207
207
* @param r {Request} HTTP request object (not used, but required for NGINX configuration)
208
- * @returns {undefined|{accessKeyId: (string), secretAccessKey: (string), sessionToken: (string), expiration: (string)} } AWS instance profile credentials or undefined
208
+ * @returns {undefined|{accessKeyId: (string), secretAccessKey: (string), sessionToken: (string|null ), expiration: (string|null )} } AWS instance profile credentials or undefined
209
209
*/
210
210
function readCredentials ( r ) {
211
211
if ( process . env [ 'S3_ACCESS_KEY_ID' ] && process . env [ 'S3_SECRET_KEY' ] ) {
@@ -382,7 +382,8 @@ function _s3DirQueryParams(uriPath, method) {
382
382
return '' ;
383
383
}
384
384
385
- // return if static website. We don't want to list the files in the directory, we want to append the index page and get the fil.
385
+ /* Return if static website. We don't want to list the files in the
386
+ directory, we want to append the index page and get the fil. */
386
387
if ( provide_index_page ) {
387
388
return '' ;
388
389
}
@@ -917,8 +918,8 @@ var maxValidityOffsetMs = 4.5 * 60 * 1000;
917
918
* @returns {Promise<void> }
918
919
*/
919
920
async function fetchCredentials ( r ) {
920
- // If we are not using an AWS instance profile to set our credentials we
921
- // exit quickly and don't write a credentials file.
921
+ /* If we are not using an AWS instance profile to set our credentials we
922
+ exit quickly and don't write a credentials file. */
922
923
if ( process . env [ 'S3_ACCESS_KEY_ID' ] && process . env [ 'S3_SECRET_KEY' ] ) {
923
924
r . return ( 200 ) ;
924
925
return ;
@@ -1025,9 +1026,10 @@ async function _fetchEC2RoleCredentials() {
1025
1026
'x-aws-ec2-metadata-token' : token ,
1026
1027
} ,
1027
1028
} ) ;
1028
- // This _might_ get multiple possible roles in other scenarios, however, EC2 supports attaching one role only.
1029
- // It should therefore be safe to take the whole output, even given IMDS _might_ (?) be able to return multiple
1030
- // roles.
1029
+ /* This _might_ get multiple possible roles in other scenarios, however,
1030
+ EC2 supports attaching one role only.It should therefore be safe to take
1031
+ the whole output, even given IMDS _might_ (?) be able to return multiple
1032
+ roles. */
1031
1033
var credName = await resp . text ( ) ;
1032
1034
if ( credName === "" ) {
1033
1035
throw 'No credentials available for EC2 instance' ;
@@ -1060,16 +1062,18 @@ async function _fetchWebIdentityCredentials(r) {
1060
1062
1061
1063
var sts_endpoint = process . env [ 'STS_ENDPOINT' ] ;
1062
1064
if ( ! sts_endpoint ) {
1063
- // On EKS, the ServiceAccount can be annotated with 'eks.amazonaws.com/sts-regional-endpoints' to control
1064
- // the usage of regional endpoints. We are using the same standard environment variable here as
1065
- // the AWS SDK. This is with the exception of replacing the value `legacy` with `global` to match
1066
- // what EKS sets the variable to.
1067
- // https://docs.aws.amazon.com/sdkref/latest/guide/feature-sts-regionalized-endpoints.html
1068
- // https://docs.aws.amazon.com/eks/latest/userguide/configure-sts-endpoint.html
1065
+ /* On EKS, the ServiceAccount can be annotated with
1066
+ 'eks.amazonaws.com/sts-regional-endpoints' to control
1067
+ the usage of regional endpoints. We are using the same standard
1068
+ environment variable here as the AWS SDK. This is with the exception
1069
+ of replacing the value `legacy` with `global` to match what EKS sets
1070
+ the variable to.
1071
+ See: https://docs.aws.amazon.com/sdkref/latest/guide/feature-sts-regionalized-endpoints.html
1072
+ See: https://docs.aws.amazon.com/eks/latest/userguide/configure-sts-endpoint.html */
1069
1073
var sts_regional = process . env [ 'AWS_STS_REGIONAL_ENDPOINTS' ] || 'global' ;
1070
1074
if ( sts_regional === 'regional' ) {
1071
- // STS regional endpoints can be derived from the region's name.
1072
- // https://docs.aws.amazon.com/general/latest/gr/sts.html
1075
+ /* STS regional endpoints can be derived from the region's name.
1076
+ See: https://docs.aws.amazon.com/general/latest/gr/sts.html */
1073
1077
var region = process . env [ 'AWS_REGION' ] ;
1074
1078
if ( region ) {
1075
1079
sts_endpoint = `https://sts.${ region } .amazonaws.com` ;
0 commit comments