-
Notifications
You must be signed in to change notification settings - Fork 55
feat: add JVM property region provider #295
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
| public companion object { | ||
| internal const val ACCESS_KEY_ID: String = "AWS_ACCESS_KEY_ID" | ||
| internal const val SECRET_ACCESS_KEY: String = "AWS_SECRET_ACCESS_KEY" | ||
| internal const val SESSION_TOKEN: String = "AWS_SESSION_TOKEN" | ||
| } | ||
|
|
||
| public constructor() : this(Platform::getenv) | ||
|
|
||
| private fun requireEnv(variable: String): String = | ||
| getEnv(variable) ?: throw ConfigurationException("Unable to get value from environment variable $variable") | ||
|
|
||
| override suspend fun getCredentials(): Credentials = Credentials( | ||
| accessKeyId = requireEnv(ACCESS_KEY_ID), | ||
| secretAccessKey = requireEnv(SECRET_ACCESS_KEY), | ||
| sessionToken = getEnv(SESSION_TOKEN), | ||
| accessKeyId = requireEnv(AwsSdkSetting.AwsAccessKeyId.environmentVariable), | ||
| secretAccessKey = requireEnv(AwsSdkSetting.AwsSecretAccessKey.environmentVariable), | ||
| sessionToken = getEnv(AwsSdkSetting.AwsSessionToken.environmentVariable), |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Much cleaner!
| /** | ||
| * The name of the corresponding JVM system property that configures the setting | ||
| */ | ||
| public val jvmProperty: String, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
comment
Would we ever have a case for a setting available via environment but not the jvm?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I thought of that and wasn't sure. I slept on it and think the answer is probably no. If there is an environment variable there ought to be a corresponding JVM property. I don't see any cases in the Java SDK where this isn't true FWIW.
Issue #
closes #202
Description of changes
Scope
By submitting this pull request, I confirm that my contribution is made under the terms of the Apache 2.0 license.