Removes redundant DB data fields and adds photo submission endpoint along with MinIO support for image storage
This commit is contained in:
@@ -0,0 +1,26 @@
|
||||
package net.halfbinary.scavengerhuntapi.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
|
||||
class S3Config(
|
||||
@Value("\${minio.endpoint}") private val endpoint: String,
|
||||
@Value("\${minio.access-key}") private val accessKey: String,
|
||||
@Value("\${minio.secret-key}") private val secretKey: String
|
||||
) {
|
||||
@Bean
|
||||
fun s3Client(): S3Client = S3Client.builder()
|
||||
.endpointOverride(URI.create(endpoint))
|
||||
.credentialsProvider(StaticCredentialsProvider.create(AwsBasicCredentials.create(accessKey, secretKey)))
|
||||
.region(Region.US_EAST_1)
|
||||
.serviceConfiguration(S3Configuration.builder().pathStyleAccessEnabled(true).build())
|
||||
.build()
|
||||
}
|
||||
Reference in New Issue
Block a user