Skip to content

Commit

Permalink
feat: sheme을 profile에따라 사용
Browse files Browse the repository at this point in the history
  • Loading branch information
jhhong0509 committed Sep 20, 2022
1 parent 5eafc8a commit b8efcc7
Show file tree
Hide file tree
Showing 4 changed files with 17 additions and 9 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,9 @@ import org.springframework.web.reactive.function.client.awaitBody
class AuthorityListSpiImpl(
private val webClient: WebClient,
@Value("\${service.authority.host}")
private val authorityHost: String
private val authorityHost: String,
@Value("\${service.scheme}")
private val scheme: String
) : AuthorityListSpi {
override suspend fun getAuthorities(userId: UUID): List<String> {
val clientResponse = sendGetAuthoritiesRequest(userId)
Expand All @@ -22,7 +24,7 @@ class AuthorityListSpiImpl(

private suspend fun sendGetAuthoritiesRequest(userId: UUID): WebClient.ResponseSpec {
return webClient.get().uri { uri ->
uri.scheme("http")
uri.scheme(scheme)
.host(authorityHost)
.path("/authorities/{userId}")
.build(userId)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,13 +14,15 @@ import org.springframework.web.reactive.function.client.awaitBody
class PointSpiImpl(
private val webClient: WebClient,
@Value("\${service.point.host}")
private val pointHost: String
private val pointHost: String,
@Value("\${service.scheme}")
private val scheme: String
) : PointSpi {
override suspend fun getUserPoint(userId: UUID): PointResponse {
return webClient.get().uri {
it.scheme("http")
it.scheme(scheme)
.host(pointHost)
.path("/point/{userId}")
.path("/points/{userId}")
.build(userId)
}.retrieve()
.onStatus(HttpStatus::isError) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,9 @@ import org.springframework.web.reactive.function.client.awaitBodilessEntity
class SaveUserBaseApplicationSpiImpl(
private val webClient: WebClient,
@Value("\${service.application.host}")
private val applicationHost: String
private val applicationHost: String,
@Value("\${service.scheme}")
private val scheme: String
) : SaveUserBaseApplicationProcessor, SaveUserBaseApplicationCompensator {
override suspend fun processStep(userId: UUID) {
val baseApplicationRequest = buildBaseApplicationRequest(userId)
Expand All @@ -27,7 +29,7 @@ class SaveUserBaseApplicationSpiImpl(
private suspend fun sendPostApplicationDefaultValue(saveUserBaseApplicationRequest: SaveUserBaseApplicationRequest) =
webClient.post()
.uri {
it.scheme("http")
it.scheme(scheme)
.host(applicationHost)
.path("/applications/signup")
.build()
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,9 @@ import org.springframework.web.reactive.function.client.awaitBodilessEntity
class SaveUserBaseAuthoritySpiImpl(
private val webClient: WebClient,
@Value("\${service.authority.host}")
private val authorityHost: String
private val authorityHost: String,
@Value("\${service.scheme}")
private val scheme: String
) : SaveUserBaseAuthorityProcessor, SaveUserBaseAuthorityCompensator {
override suspend fun processStep(userId: UUID) {
val request = SaveUserBaseAuthorityRequest(userId)
Expand All @@ -24,7 +26,7 @@ class SaveUserBaseAuthoritySpiImpl(
private suspend fun sendSaveUserBaseAuthorityRequest(saveUserBaseAuthorityRequest: SaveUserBaseAuthorityRequest) {
webClient.post()
.uri {
it.scheme("http")
it.scheme(scheme)
.host(authorityHost)
.path("/authorities/access-management/basic")
.build()
Expand Down

0 comments on commit b8efcc7

Please sign in to comment.