Skip to content

Commit d069f40

Browse files
committed
improve property resolution
1 parent 2b778b4 commit d069f40

File tree

1 file changed

+11
-6
lines changed

1 file changed

+11
-6
lines changed

AwsClient.scala

Lines changed: 11 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -152,13 +152,18 @@ object AwsClient {
152152
includeEnvironmentVariables: Boolean = true
153153
): AwsClient =
154154
initializeWithProperties { key =>
155-
map
156-
.get(key)
157-
.orElse(
158-
if (includeEnvironmentVariables)
159-
then scala.util.Try(System.getenv(key)).toOption
160-
else None
155+
scala.util
156+
.Try(
157+
map
158+
.get(key)
159+
.orElse(
160+
if (includeEnvironmentVariables)
161+
then scala.util.Try(Option(System.getenv(key))).toOption.flatten
162+
else None
163+
)
161164
)
165+
.toOption
166+
.flatten
162167
}
163168

164169
/** Creates new instance of the AwsClient for the given region using a function to retrieve system properties

0 commit comments

Comments
 (0)