Skip to content

Commit

Permalink
Merge pull request #32 from ClothingStoreService/feat/vault-apply
Browse files Browse the repository at this point in the history
Feat/vault apply
  • Loading branch information
hjj4060 authored Sep 4, 2024
2 parents 2cfe7cd + e88421d commit a9bd16d
Show file tree
Hide file tree
Showing 9 changed files with 56 additions and 6 deletions.
5 changes: 5 additions & 0 deletions build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -72,6 +72,11 @@ dependencies {
implementation("org.springframework.boot:spring-boot-starter-mail") //mail 전송
implementation("org.springframework.boot:spring-boot-starter-data-redis") //redis
testRuntimeOnly("org.junit.platform:junit-platform-launcher")

//vault
implementation("org.springframework.cloud:spring-cloud-starter-bootstrap:4.1.4")
implementation("org.springframework.cloud:spring-cloud-config-server:4.1.3")
implementation("org.springframework.cloud:spring-cloud-starter-vault-config:4.1.3")
}

tasks.withType<Test> {
Expand Down
2 changes: 2 additions & 0 deletions src/main/kotlin/org/store/clothstar/ClothstarApplication.kt
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,8 @@ import org.springframework.data.jpa.repository.config.EnableJpaAuditing
@SpringBootApplication
@EnableJpaAuditing //Jpa Auditing 기능 활성화
class ClothstarApplication {


}

fun main(args: Array<String>) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -66,7 +66,8 @@ class SecurityConfiguration(
"/v1/orderdetails", "/v1/orders", "/v2/orders", "/v3/orders", "/v1/orders/list",
"/v1/orders/list", "/ordersPagingOffset", "/ordersPagingSlice", "/v2/orders/list",
"/v1/seller/orders/**", "/v1/seller/orders", "/v1/orders/**", "/v1/orderdetails/**",
"/swagger-resources/**", "/swagger-ui/**", "/v3/api-docs/**", "/v1/members/auth/**"
"/swagger-resources/**", "/swagger-ui/**", "/v3/api-docs/**", "/v1/members/auth/**",
"config-service/**"
).permitAll()
.requestMatchers(HttpMethod.POST, "/v1/members").permitAll()
.requestMatchers(HttpMethod.POST, "/v1/sellers/**").authenticated()
Expand Down
5 changes: 4 additions & 1 deletion src/main/resources/application.yml
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ spring:
port: 6379
duration: 600

email.send: ENC(kGXTSlfxUWNbRoGuBwNRTJBETjMz04AChYMrwDeY3Cs=)
email.send: ${email.send}

springdoc:
default-consumes-media-type: application/json # ?? ??? ??
Expand All @@ -41,3 +41,6 @@ springdoc:
tags-sorter: alpha # tag ?? ??? ??? ?
#path: "swagger.html" # http://localhost:8080/swagger.html? ?? ??
path: "/" # http://localhost:8080? ?? ??



12 changes: 12 additions & 0 deletions src/main/resources/bootstrap.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
spring:
application:
name: application
cloud:
vault:
uri: http://43.200.201.142:8200
authentication: TOKEN
token: hvs.SdEQtUjhGCUvZXaEO43yf5id # Vault Root Token
kv:
enabled: true
backend: secret
default-context: application
Original file line number Diff line number Diff line change
Expand Up @@ -11,11 +11,11 @@ class JasyptConfigTest {

@Test
fun jasypt() {
val url = ""
val url = "kGXTSlfxUWNbRoGuBwNRTJBETjMz04AChYMrwDeY3Cs="
val username = ""
val password = ""

println(jasyptEncoding(url))
println(jasyptDecoding(url))
println(jasyptEncoding(username))
println(jasyptEncoding(password))
}
Expand Down
16 changes: 16 additions & 0 deletions src/test/kotlin/org/store/clothstar/common/config/VaultDataTest.kt
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
package org.store.clothstar.common.config

import org.junit.jupiter.api.Test
import org.springframework.beans.factory.annotation.Value
import org.springframework.boot.test.context.SpringBootTest

@SpringBootTest
class VaultDataTest {
@Value("\${email.send}")
lateinit var email: String

@Test
fun demoTest() {
println("email : ${email}")
}
}
3 changes: 1 addition & 2 deletions src/test/resources/application-test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,6 @@ spring:
host: ENC(GUuFDW7HjE98e7N28Vkb/xoIEgLeOCb5)
port: 6379
duration: 600

jpa:
hibernate:
ddl-auto: create
Expand All @@ -44,4 +43,4 @@ jwt:
accessTokenValidTimeMillis: 120000
refreshTokenValidTimeMillis: 1200000

email.send: ENC(kGXTSlfxUWNbRoGuBwNRTJBETjMz04AChYMrwDeY3Cs=)
email.send: ${email.send}
12 changes: 12 additions & 0 deletions src/test/resources/bootstrap.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
spring:
application:
name: application
cloud:
vault:
uri: http://43.200.201.142:8200
authentication: TOKEN
token: hvs.SdEQtUjhGCUvZXaEO43yf5id # Vault Root Token
kv:
enabled: true
backend: secret
default-context: application

0 comments on commit a9bd16d

Please sign in to comment.