Merge pull request #1408 from gaul/env

Ensure environment variable is set when using ECS
This commit is contained in:
Takeshi Nakatani 2020-09-20 13:01:17 +09:00 committed by GitHub
commit 075d161bb1
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -2678,7 +2678,12 @@ int S3fsCurl::GetIAMCredentials()
// url
if(is_ecs){
url = std::string(S3fsCurl::IAM_cred_url) + std::getenv(ECS_IAM_ENV_VAR.c_str());
const char *env = std::getenv(ECS_IAM_ENV_VAR.c_str());
if(env == NULL){
S3FS_PRN_ERR("%s is not set.", ECS_IAM_ENV_VAR.c_str());
return -EIO;
}
url = std::string(S3fsCurl::IAM_cred_url) + env;
}else{
url = std::string(S3fsCurl::IAM_cred_url) + S3fsCurl::IAM_role;
}