Skip to content

Commit

Permalink
fix some thing
Browse files Browse the repository at this point in the history
  • Loading branch information
徐文平 committed Nov 6, 2024
1 parent 2f9cd00 commit 395904c
Show file tree
Hide file tree
Showing 3 changed files with 5 additions and 5 deletions.
2 changes: 1 addition & 1 deletion src/providers/cli_profile.ts
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ class CLIProfileCredentialsProviderBuilder {
this.profileName = process.env.ALIBABA_CLOUD_PROFILE;
}

if (process.env.ALIBABA_CLOUD_CLI_PROFILE_DISABLED?.toLowerCase() === 'true') {
if (process.env.ALIBABA_CLOUD_CLI_PROFILE_DISABLED && process.env.ALIBABA_CLOUD_CLI_PROFILE_DISABLED.toLowerCase() === 'true') {
throw new Error('the CLI profile is disabled');
}

Expand Down
6 changes: 3 additions & 3 deletions src/providers/ecs_ram_role.ts
Original file line number Diff line number Diff line change
Expand Up @@ -199,8 +199,8 @@ class ECSRAMRoleCredentialsProviderBuilder {

build(): ECSRAMRoleCredentialsProvider {
// 允许通过环境变量强制关闭 IMDS
if (process.env.ALIBABA_CLOUD_ECS_METADATA_DISABLED?.toLowerCase() === 'true') {
throw new Error('IMDS credentials is disabled')
if (process.env.ALIBABA_CLOUD_ECS_METADATA_DISABLED && process.env.ALIBABA_CLOUD_ECS_METADATA_DISABLED.toLowerCase() === 'true') {
throw new Error('IMDS credentials is disabled');
}

// 设置 roleName 默认值
Expand All @@ -209,7 +209,7 @@ class ECSRAMRoleCredentialsProviderBuilder {
}

// 允许通过环境变量强制关闭 V1
if (process.env.ALIBABA_CLOUD_IMDSV1_DISABLED?.toLowerCase() === 'true') {
if (process.env.ALIBABA_CLOUD_IMDSV1_DISABLED && process.env.ALIBABA_CLOUD_IMDSV1_DISABLED.toLowerCase() === 'true') {
this.disableIMDSv1 = true;
}

Expand Down
2 changes: 1 addition & 1 deletion src/providers/ram_role_arn.ts
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@ class RAMRoleARNCredentialsProviderBuilder {
}

if (!this.enableVpc) {
this.enableVpc = process.env.ALIBABA_CLOUD_VPC_ENDPOINT_ENABLED?.toLowerCase() === 'true' || false;
this.enableVpc = process.env.ALIBABA_CLOUD_VPC_ENDPOINT_ENABLED && process.env.ALIBABA_CLOUD_VPC_ENDPOINT_ENABLED.toLowerCase() === 'true' || false;
}

// duration seconds
Expand Down

0 comments on commit 395904c

Please sign in to comment.