Skip to content

Commit

Permalink
Allow setting URLs for REST clients via env vars
Browse files Browse the repository at this point in the history
  • Loading branch information
pvannierop committed Oct 29, 2024
1 parent 233fe9b commit b01fcfb
Showing 1 changed file with 4 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -6,9 +6,9 @@ import java.util.Locale
data class RestSourceClient(
val sourceType: String,
val preAuthorizationEndpoint: String?,
val authorizationEndpoint: String,
val authorizationEndpoint: String?,
val deregistrationEndpoint: String?,
val tokenEndpoint: String,
val tokenEndpoint: String?,
val clientId: String? = null,
val clientSecret: String? = null,
val grantType: String? = null,
Expand All @@ -18,4 +18,6 @@ data class RestSourceClient(
fun withEnv(): RestSourceClient = this
.copyEnv("${sourceType.uppercase(Locale.US)}_CLIENT_ID") { copy(clientId = it) }
.copyEnv("${sourceType.uppercase(Locale.US)}_CLIENT_SECRET") { copy(clientSecret = it) }
.copyEnv("${sourceType.uppercase(Locale.US)}_CLIENT_AUTH_URL") { copy(authorizationEndpoint = it) }
.copyEnv("${sourceType.uppercase(Locale.US)}_CLIENT_TOKEN_URL") { copy(tokenEndpoint = it) }
}

0 comments on commit b01fcfb

Please sign in to comment.