Fix S3 endpoint: add http:// prefix if missing
All checks were successful
BotServer CI/CD / build (push) Successful in 4m28s
All checks were successful
BotServer CI/CD / build (push) Successful in 4m28s
This commit is contained in:
parent
514427c7cc
commit
0fad62aed9
1 changed files with 11 additions and 4 deletions
|
|
@ -141,10 +141,17 @@ pub async fn create_s3_operator(
|
||||||
config: &DriveConfig,
|
config: &DriveConfig,
|
||||||
) -> Result<S3Client, Box<dyn std::error::Error>> {
|
) -> Result<S3Client, Box<dyn std::error::Error>> {
|
||||||
log::info!("Creating S3 operator with server: {}, access_key: {}", config.server, config.access_key);
|
log::info!("Creating S3 operator with server: {}, access_key: {}", config.server, config.access_key);
|
||||||
let endpoint = if config.server.ends_with('/') {
|
let endpoint = {
|
||||||
|
let server = if config.server.starts_with("http://") || config.server.starts_with("https://") {
|
||||||
config.server.clone()
|
config.server.clone()
|
||||||
} else {
|
} else {
|
||||||
format!("{}/", config.server)
|
format!("http://{}", config.server)
|
||||||
|
};
|
||||||
|
if server.ends_with('/') {
|
||||||
|
server
|
||||||
|
} else {
|
||||||
|
format!("{}/", server)
|
||||||
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
let (access_key, secret_key) = if config.access_key.is_empty() || config.secret_key.is_empty() {
|
let (access_key, secret_key) = if config.access_key.is_empty() || config.secret_key.is_empty() {
|
||||||
|
|
|
||||||
Loading…
Add table
Reference in a new issue