diff --git a/micord.env b/micord.env index 304585b..efd6a58 100644 --- a/micord.env +++ b/micord.env @@ -22,8 +22,7 @@ AV_RETRY_DELAY_MILLISECONDS=1000 FILE_SAVING_PATH=/transfer/ -S3_ENDPOINT=http://ervu-minio.k8s.micord.ru -S3_PORT=31900 +S3_ENDPOINT=http://ervu-minio.k8s.micord.ru:31900 S3_ACCESS_KEY=rlTdTvkmSXu9FsLhfecw S3_SECRET_KEY=NUmY0wwRIEyAd98GCKd1cOgJWvLQYAcMMul5Ulu0 S3_OUT_BUCKET_NAME=default-out-bucket diff --git a/src/main/java/ru/micord/ervu/av/s3/S3Connection.java b/src/main/java/ru/micord/ervu/av/s3/S3Connection.java index ad53872..44a7231 100644 --- a/src/main/java/ru/micord/ervu/av/s3/S3Connection.java +++ b/src/main/java/ru/micord/ervu/av/s3/S3Connection.java @@ -19,8 +19,6 @@ import org.springframework.context.annotation.Configuration; public class S3Connection { @Value("${s3.out.endpoint}") private String endpointOut; - @Value("${s3.out.port:9000}") - private int portOut; @Value("${s3.out.access_key}") private String accessKeyOut; @Value("${s3.out.secret_key}") @@ -37,17 +35,19 @@ public class S3Connection { @Bean("outClient") public AmazonS3 getS3OutClient() { + return getS3Client(endpointOut, accessKeyOut, secretKeyOut); return getS3Client(endpointOut, portOut, accessKeyOut, secretKeyOut, pathStyleAccessEnabled); } + private static AmazonS3 getS3Client(String endpoint, String accessKey, + String secretKey) { private static AmazonS3 getS3Client(String endpoint, int port, String accessKey, String secretKey, boolean pathStyleAccessEnabled) { AWSCredentials credentials = new BasicAWSCredentials(accessKey, secretKey); - String s3Endpoint = endpoint + ":" + port; String region = Region.getRegion(Regions.DEFAULT_REGION).toString(); return AmazonS3ClientBuilder.standard() - .withEndpointConfiguration(new AwsClientBuilder.EndpointConfiguration(s3Endpoint, region)) + .withEndpointConfiguration(new AwsClientBuilder.EndpointConfiguration(endpoint, region)) .withCredentials(new AWSStaticCredentialsProvider(credentials)) .withPathStyleAccessEnabled(pathStyleAccessEnabled) .build(); diff --git a/src/main/resources/application.properties b/src/main/resources/application.properties index f0e4dd0..6b7726e 100644 --- a/src/main/resources/application.properties +++ b/src/main/resources/application.properties @@ -43,13 +43,12 @@ kafka.out.success.topic.name=${ERVU_KAFKA_SUCCESS_TOPIC_NAME} kafka.out.response.topic.name=${ERVU_KAFKA_RESPONSE_TOPIC_NAME} # av.rest.address=${AV_REST_ADDRESS} -av.first.timeout.milliseconds=${AV_FIRST_TIMEOUT_MILLISECONDS} -av.retry.max.attempts.count=${AV_RETRY_MAX_ATTEMPTS_COUNT} -av.retry.delay.milliseconds=${AV_RETRY_DELAY_MILLISECONDS} -file.saving.path=${FILE_SAVING_PATH} +av.first.timeout.milliseconds=${AV_FIRST_TIMEOUT_MILLISECONDS:1000} +av.retry.max.attempts.count=${AV_RETRY_MAX_ATTEMPTS_COUNT:10} +av.retry.delay.milliseconds=${AV_RETRY_DELAY_MILLISECONDS:1000} +file.saving.path=${FILE_SAVING_PATH:/transfer/} # s3.out.endpoint=${S3_ENDPOINT} -s3.out.port=${S3_PORT} s3.out.access_key=${S3_ACCESS_KEY} s3.out.secret_key=${S3_SECRET_KEY} s3.out.bucket_name=${S3_OUT_BUCKET_NAME}