Last active
August 2, 2018 15:40
-
-
Save chathurangat/2129ef87c733506b5c3e463928fb4caf to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import org.springframework.beans.factory.annotation.Value; | |
import org.springframework.context.annotation.Bean; | |
import org.springframework.context.annotation.Configuration; | |
import com.amazonaws.auth.AWSCredentialsProvider; | |
import com.amazonaws.auth.AWSStaticCredentialsProvider; | |
import com.amazonaws.auth.BasicAWSCredentials; | |
import com.amazonaws.regions.Region; | |
import com.amazonaws.regions.Regions; | |
@Configuration | |
public class AmazonS3Config | |
{ | |
@Value("${aws.access.key.id}") | |
private String awsKeyId; | |
@Value("${aws.access.key.secret}") | |
private String awsKeySecret; | |
@Value("${aws.region}") | |
private String awsRegion; | |
@Value("${aws.s3.audio.bucket}") | |
private String awsS3AudioBucket; | |
@Bean(name = "awsKeyId") | |
public String getAWSKeyId() { | |
return awsKeyId; | |
} | |
@Bean(name = "awsKeySecret") | |
public String getAWSKeySecret() { | |
return awsKeySecret; | |
} | |
@Bean(name = "awsRegion") | |
public Region getAWSPollyRegion() { | |
return Region.getRegion(Regions.fromName(awsRegion)); | |
} | |
@Bean(name = "awsCredentialsProvider") | |
public AWSCredentialsProvider getAWSCredentials() { | |
BasicAWSCredentials awsCredentials = new BasicAWSCredentials(this.awsKeyId, this.awsKeySecret); | |
return new AWSStaticCredentialsProvider(awsCredentials); | |
} | |
@Bean(name = "awsS3AudioBucket") | |
public String getAWSS3AudioBucket() { | |
return awsS3AudioBucket; | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment