docs(report): fill REPORT.md for lab4 grade 3
This commit is contained in:
@@ -0,0 +1,42 @@
|
||||
package ru.mtusi.messenger.config;
|
||||
|
||||
import org.springframework.beans.factory.annotation.Value;
|
||||
import org.springframework.context.annotation.Bean;
|
||||
import org.springframework.context.annotation.Configuration;
|
||||
import software.amazon.awssdk.auth.credentials.AwsBasicCredentials;
|
||||
import software.amazon.awssdk.auth.credentials.StaticCredentialsProvider;
|
||||
import software.amazon.awssdk.regions.Region;
|
||||
import software.amazon.awssdk.services.s3.S3Client;
|
||||
import software.amazon.awssdk.services.s3.S3Configuration;
|
||||
|
||||
import java.net.URI;
|
||||
|
||||
@Configuration
|
||||
public class S3Config {
|
||||
|
||||
@Value("${S3_ENDPOINT:http://minio:9000}")
|
||||
private String endpoint;
|
||||
|
||||
@Value("${S3_ACCESS_KEY:minioadmin}")
|
||||
private String accessKey;
|
||||
|
||||
@Value("${S3_SECRET_KEY:minioadmin}")
|
||||
private String secretKey;
|
||||
|
||||
@Value("${S3_REGION:us-east-1}")
|
||||
private String region;
|
||||
|
||||
@Bean
|
||||
public S3Client s3Client() {
|
||||
return S3Client.builder()
|
||||
.endpointOverride(URI.create(endpoint))
|
||||
.credentialsProvider(StaticCredentialsProvider.create(
|
||||
AwsBasicCredentials.create(accessKey, secretKey)))
|
||||
.region(Region.of(region))
|
||||
// MinIO требует path-style access (не virtual-hosted)
|
||||
.serviceConfiguration(S3Configuration.builder()
|
||||
.pathStyleAccessEnabled(true)
|
||||
.build())
|
||||
.build();
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user