Move S3 connection details from hardcoded values to application properties.

This allows for greater flexibility in configuring the S3 storage provider for different environments without requiring code changes.

- Add `endpoint` and `region` to `S3Props`
- Update `S3Config` to use the new properties
- Add new S3 properties to `application-local.properties.dist`
This commit is contained in:
2025-07-26 13:55:28 +03:00
parent 4f34296e6f
commit 7e3a4ddb3a
3 changed files with 16 additions and 5 deletions

View File

@@ -11,8 +11,8 @@ class S3Config {
@Bean
fun s3Client(s3Props: S3Props): MinioClient =
MinioClient.builder()
.endpoint("https://storage.yandexcloud.net")
.region("ru-central1")
.endpoint(s3Props.endpoint)
.region(s3Props.region)
.credentials(s3Props.accessKeyId, s3Props.secretAccessKey)
.build()
}

View File

@@ -3,4 +3,10 @@ package com.pischule.memevizor.upload
import org.springframework.boot.context.properties.ConfigurationProperties
@ConfigurationProperties("s3")
data class S3Props(val accessKeyId: String, val secretAccessKey: String, val bucket: String)
data class S3Props(
val endpoint: String,
val region: String,
val accessKeyId: String,
val secretAccessKey: String,
val bucket: String,
)

View File

@@ -1,3 +1,8 @@
bot.forward-chat-id=<?>
bot.approver<?>
bot.token=<bot token>
bot.approver-user-ids[0]=<?>
bot.token=
s3.endpoint=https://storage.yandexcloud.net
s3.region=ru-central1
s3.bucket=memevizor-test
s3.access-key-id=<?>
s3.secret-access-key=<?>