-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Refactor: S3 & Kakao & Jwt Properties 환경변수 중앙 집중 관리[박한솔]
- Loading branch information
Showing
17 changed files
with
114 additions
and
83 deletions.
There are no files selected for viewing
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
Binary file modified
BIN
-114 Bytes
(100%)
web3-credential-server/build/tmp/compileJava/previous-compilation-data.bin
Binary file not shown.
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
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
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
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
9 changes: 9 additions & 0 deletions
9
web3-credential-server/src/main/java/web3/properties/JwtProperties.java
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
package web3.properties; | ||
|
||
import org.springframework.boot.context.properties.ConfigurationProperties; | ||
|
||
@ConfigurationProperties(prefix = "jwt") | ||
public record JwtProperties ( | ||
String key | ||
){ | ||
} |
2 changes: 1 addition & 1 deletion
2
...eb3/properties/kakao/KakaoProperties.java → ...java/web3/properties/KakaoProperties.java
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
40 changes: 40 additions & 0 deletions
40
web3-credential-server/src/main/java/web3/properties/S3Properties.java
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,40 @@ | ||
package web3.properties; | ||
|
||
import lombok.Getter; | ||
import lombok.Setter; | ||
import lombok.extern.slf4j.Slf4j; | ||
import org.springframework.boot.context.properties.ConfigurationProperties; | ||
import org.springframework.context.annotation.Configuration; | ||
import jakarta.annotation.PostConstruct; | ||
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; | ||
|
||
@Configuration | ||
@ConfigurationProperties(prefix = "cloud.aws") | ||
@Getter | ||
@Setter | ||
@Slf4j | ||
public class S3Properties { | ||
|
||
private String s3BucketName; | ||
private String credentialsAccessKey; | ||
private String credentialsSecretKey; | ||
private String s3BucketUrl; | ||
private String regionStatic; | ||
private S3Client s3Client; | ||
|
||
@PostConstruct | ||
public void init() { | ||
if (regionStatic == null || regionStatic.trim().isEmpty()) { | ||
throw new IllegalStateException("Region must not be null or empty"); | ||
} | ||
this.s3Client = S3Client.builder() | ||
.region(Region.of(regionStatic)) | ||
.credentialsProvider(StaticCredentialsProvider.create( | ||
AwsBasicCredentials.create(credentialsAccessKey, credentialsSecretKey))) | ||
.build(); | ||
} | ||
|
||
} |
18 changes: 10 additions & 8 deletions
18
web3-credential-server/src/main/java/web3/s3Storage/config/S3Config.java
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,21 +1,23 @@ | ||
package web3.s3Storage.config; | ||
|
||
import lombok.RequiredArgsConstructor; | ||
import org.springframework.context.annotation.Bean; | ||
import org.springframework.context.annotation.Configuration; | ||
import software.amazon.awssdk.regions.Region; | ||
import software.amazon.awssdk.services.s3.S3Client; | ||
import org.springframework.beans.factory.annotation.Value; | ||
|
||
import web3.properties.S3Properties; | ||
/* | ||
@Configuration | ||
@RequiredArgsConstructor | ||
public class S3Config { | ||
|
||
@Value("${cloud.aws.region.static}") | ||
private String region; | ||
|
||
private final S3Properties s3Properties; | ||
@Bean | ||
public S3Client s3Client() { | ||
return S3Client.builder() | ||
.region(Region.of(region)) | ||
.region(Region.of(s3Properties.getRegionStatic())) | ||
.build(); | ||
} | ||
} | ||
} | ||
*/ |
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
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
2 changes: 1 addition & 1 deletion
2
...java/web3/common/dto/jwt/JwtResponse.java → ...ava/web3/service/dto/jwt/JwtResponse.java
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
Oops, something went wrong.