Skip to content

Commit 449612b

Browse files
shawnhankimdekobon
authored andcommitted
chore: replace HOSTNAME with AWS_ROLE_SESSION_NAME
1 parent 692266f commit 449612b

File tree

3 files changed

+10
-7
lines changed

3 files changed

+10
-7
lines changed

common/docker-entrypoint.d/00-check-for-required-env.sh

Lines changed: 7 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -52,10 +52,13 @@ elif curl --output /dev/null --silent --head --fail --connect-timeout 2 --max-ti
5252
# Example: We are running inside an EKS cluster with IAM roles for service accounts enabled.
5353
elif [[ -v AWS_WEB_IDENTITY_TOKEN_FILE ]]; then
5454
echo "Running inside EKS with IAM roles for service accounts"
55-
if [[ ! -v HOSTNAME ]]; then
56-
# This environment value is used for Role Session Name. The default value is
57-
# set as a nginx-s3-gateway unless the value is defined.
58-
HOSTNAME="nginx-s3-gateway"
55+
if [[ -v HOSTNAME ]]; then
56+
echo "Depreciated the HOSTNAME! Use the environment variable of AWS_ROLE_SESSION_NAME instead"
57+
failed=1
58+
fi
59+
if [[ ! -v AWS_ROLE_SESSION_NAME ]]; then
60+
# The default value is set as a nginx-s3-gateway unless the value is defined.
61+
AWS_ROLE_SESSION_NAME="nginx-s3-gateway"
5962
fi
6063

6164
elif [[ -v S3_ACCESS_KEY_ID ]]; then

common/etc/nginx/include/awscredentials.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -362,14 +362,14 @@ async function _fetchEC2RoleCredentials() {
362362

363363
/**
364364
* Get the credentials by assuming calling AssumeRoleWithWebIdentity with the environment variable
365-
* values ROLE_ARN, AWS_WEB_IDENTITY_TOKEN_FILE and HOSTNAME
365+
* values ROLE_ARN, AWS_WEB_IDENTITY_TOKEN_FILE and AWS_ROLE_SESSION_NAME
366366
*
367367
* @returns {Promise<{accessKeyId: (string), secretAccessKey: (string), sessionToken: (string), expiration: (string)}>}
368368
* @private
369369
*/
370370
async function _fetchWebIdentityCredentials(r) {
371371
const arn = process.env['AWS_ROLE_ARN'];
372-
const name = process.env['HOSTNAME'];
372+
const name = process.env['AWS_ROLE_SESSION_NAME'];
373373

374374
let sts_endpoint = process.env['STS_ENDPOINT'];
375375
if (!sts_endpoint) {

docs/getting_started.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -51,7 +51,7 @@ file.
5151

5252
There are few optional environment variables that can be used.
5353

54-
* `HOSTNAME` - (optional) The value will be used for Role Session Name. The default value is nginx-s3-gateway.
54+
* `AWS_ROLE_SESSION_NAME` - (optional) The value will be used for Role Session Name. The default value is nginx-s3-gateway.
5555
* `STS_ENDPOINT` - (optional) Overrides the STS endpoint to be used in applicable setups. This is not required when running on EKS. See the EKS portion of the guide below for more details.
5656
* `AWS_STS_REGIONAL_ENDPOINTS` - (optional) Allows for a regional STS endpoint to be
5757
selected. When the regional model is selected then the STS endpoint generated will

0 commit comments

Comments
 (0)