Skip to content

Commit

Permalink
Add default environment to CredentialsProvider
Browse files Browse the repository at this point in the history
  • Loading branch information
daviddenton committed Sep 3, 2024
1 parent 29fd700 commit 1787cac
Showing 1 changed file with 2 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -2,12 +2,13 @@ package org.http4k.connect.amazon

import org.http4k.aws.AwsCredentials
import org.http4k.config.Environment
import org.http4k.config.Environment.Companion.ENV

fun interface CredentialsProvider : () -> AwsCredentials {
companion object
}

fun CredentialsProvider.Companion.Environment(env: Environment) = CredentialsProvider { AWS_CREDENTIALS(env) }
fun CredentialsProvider.Companion.Environment(env: Environment = ENV) = CredentialsProvider { AWS_CREDENTIALS(env) }

fun CredentialsProvider.Companion.Environment(env: Map<String, String> = System.getenv()) =
Environment(Environment.from(env))

0 comments on commit 1787cac

Please sign in to comment.