Skip to content

Commit 5ea1808

Browse files
committed
fix: secret key issue for S3_SECRET_KEY_CSVJSONL not using S3_SECRET_KEY properly
1 parent 03a118a commit 5ea1808

File tree

1 file changed

+11
-7
lines changed

1 file changed

+11
-7
lines changed

server/src/operators/file_operator.rs

Lines changed: 11 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -113,13 +113,17 @@ pub fn get_csvjsonl_aws_bucket() -> Result<Bucket, ServiceError> {
113113
} else {
114114
let s3_access_key = std::env::var("S3_ACCESS_KEY_CSVJSONL")
115115
.unwrap_or(get_env!("S3_ACCESS_KEY", "S3_ACCESS_KEY should be set").to_string());
116-
let s3_secret_key = std::env::var("S3_SECRET_KEY_CSVJSONL").unwrap_or(
117-
get_env!(
118-
"S3_SECRET_KEY",
119-
"S3_SECRET_KEY should be set"
120-
)
121-
.to_string(),
122-
);
116+
let s3_secret_key = match std::env::var("S3_SECRET_KEY_CSVJSONL") {
117+
Ok(val) => val,
118+
Err(_) => match std::env::var("S3_SECRET_KEY") {
119+
Ok(val) => val,
120+
Err(_) => {
121+
return Err(ServiceError::BadRequest(
122+
"S3_SECRET_KEY_CSVJSONL or S3_SECRET_KEY should be set".to_string(),
123+
));
124+
}
125+
},
126+
};
123127

124128
Credentials {
125129
access_key: Some(s3_access_key),

0 commit comments

Comments
 (0)