|
25 | 25 | * <p><b>Required application properties:</b> |
26 | 26 | * |
27 | 27 | * <ul> |
28 | | - * <li>{@code b2.key.id} - Application key ID for authentication |
29 | | - * <li>{@code b2.application.key} - Application key secret for authentication |
30 | | - * <li>{@code b2.bucket.name} - Target bucket name |
31 | | - * <li>{@code b2.region} - Storage region (e.g., "us-west-001") |
32 | | - * <li>{@code b2.endpoint.prefix} - Endpoint URL prefix (e.g., "<a href="">https://s3</a>.") |
33 | | - * <li>{@code b2.endpoint.suffix} - Endpoint URL suffix (e.g., ".backblazeb2.com") |
34 | | - * </ul> |
35 | | - * |
36 | | - * <p><b>Endpoint construction:</b> |
37 | | - * |
38 | | - * <ul> |
39 | | - * <li>Production: {@code prefix + region + suffix} (e.g., |
40 | | - * "https://s3.us-west-001.backblazeb2.com") |
41 | | - * <li>Local development: Uses prefix only if it contains "localhost" or "127.0.0.1" |
| 28 | + * <li>{@code cloud.storage.key.id} - Application key ID for authentication |
| 29 | + * <li>{@code cloud.storage.application.key} - Application key secret for authentication |
| 30 | + * <li>{@code cloud.storage.bucket.name} - Target bucket name |
| 31 | + * <li>{@code cloud.storage.region} - Storage region (e.g., "us-west-006") |
| 32 | + * <li>{@code cloud.storage.full-endpoint} - Endpoint URL prefix (e.g., "<a |
| 33 | + * href="">https://s3.us-west-006.backblaze.com</a>.") |
42 | 34 | * </ul> |
43 | 35 | * |
44 | 36 | * <p>The configuration automatically cleans up resources on application shutdown via the {@link |
@@ -70,30 +62,21 @@ public class BucketConf { |
70 | 62 | * both an async transfer manager for file operations and a presigner for generating temporary |
71 | 63 | * access URLs. |
72 | 64 | * |
73 | | - * <p><b>Endpoint resolution:</b> If the endpoint prefix contains "localhost" or "127.0.0.1" (for |
74 | | - * local testing), uses the prefix as-is. Otherwise, constructs the full endpoint by concatenating |
75 | | - * prefix + region + suffix. |
76 | | - * |
77 | 65 | * @param keyId the application key ID for B2 authentication |
78 | 66 | * @param applicationKey the application key secret for B2 authentication |
79 | 67 | * @param bucketName the target bucket name |
80 | 68 | * @param regionString the storage region identifier |
81 | | - * @param endpointPrefix the endpoint URL prefix (e.g., "<a href="">https://s3</a>.") |
82 | | - * @param endpointSuffix the endpoint URL suffix (e.g., ".backblazeb2.com") |
| 69 | + * @param fullEndpoint the endpoint URL (e.g., ""<a |
| 70 | + * href="">https://s3.us-west-006.backblaze.com</a>.") |
83 | 71 | */ |
84 | 72 | @SneakyThrows |
85 | 73 | public BucketConf( |
86 | | - @Value("${b2.key.id}") String keyId, |
87 | | - @Value("${b2.application.key}") String applicationKey, |
88 | | - @Value("${b2.bucket.name}") String bucketName, |
89 | | - @Value("${b2.region}") String regionString, |
90 | | - @Value("${b2.endpoint.prefix}") String endpointPrefix, |
91 | | - @Value("${b2.endpoint.suffix}") String endpointSuffix) { |
| 74 | + @Value("${cloud.storage.key.id}") String keyId, |
| 75 | + @Value("${cloud.storage.application.key}") String applicationKey, |
| 76 | + @Value("${cloud.storage.bucket.name}") String bucketName, |
| 77 | + @Value("${cloud.storage.region}") String regionString, |
| 78 | + @Value("${cloud.storage.full-endpoint}") String fullEndpoint) { |
92 | 79 | this.bucketName = bucketName; |
93 | | - String fullEndpoint = |
94 | | - (endpointPrefix.contains("localhost") || endpointPrefix.contains("127.0.0.1")) |
95 | | - ? endpointPrefix |
96 | | - : endpointPrefix + regionString + endpointSuffix; |
97 | 80 | URI endpoint = URI.create(fullEndpoint); |
98 | 81 |
|
99 | 82 | Region region = Region.of(regionString); |
|
0 commit comments