Skip to content

Commit

Permalink
fix: Conditional set auth envvars
Browse files Browse the repository at this point in the history
  • Loading branch information
SMadani committed Jun 26, 2024
1 parent e996546 commit 84c0a2e
Showing 1 changed file with 10 additions and 5 deletions.
15 changes: 10 additions & 5 deletions src/main/kotlin/com/vonage/client/kt/Vonage.kt
Original file line number Diff line number Diff line change
Expand Up @@ -15,11 +15,16 @@ class Vonage constructor(init: VonageClient.Builder.() -> Unit) {
}

fun VonageClient.Builder.authFromEnv(): VonageClient.Builder {
apiKey(env("VONAGE_API_KEY"))
apiSecret(env("VONAGE_API_SECRET"))
signatureSecret(env("VONAGE_SIGNATURE_SECRET"))
applicationId(env("VONAGE_APPLICATION_ID"))
privateKeyPath(env("VONAGE_PRIVATE_KEY_PATH"))
val apiKey = env("VONAGE_API_KEY")
val apiSecret = env("VONAGE_API_SECRET")
val signatureSecret = env("VONAGE_SIGNATURE_SECRET")
val applicationId = env("VONAGE_APPLICATION_ID")
val privateKeyPath = env("VONAGE_PRIVATE_KEY_PATH")
if (apiKey != null) apiKey(apiKey)
if (apiSecret != null) apiSecret(apiSecret)
if (signatureSecret != null) signatureSecret(signatureSecret)
if (applicationId != null) applicationId(applicationId)
if (privateKeyPath != null) privateKeyPath(privateKeyPath)
return this
}

Expand Down

0 comments on commit 84c0a2e

Please sign in to comment.