Skip to content

Commit

Permalink
Fixed API usage for jdk8
Browse files Browse the repository at this point in the history
  • Loading branch information
sksamuel committed Aug 16, 2021
1 parent d614616 commit 26bba03
Showing 1 changed file with 2 additions and 4 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ import com.sksamuel.hoplite.fp.getOrElse
import com.sksamuel.hoplite.preprocessor.TraversingPrimitivePreprocessor

/**
* Creates a [Preprocessor] that will replace strings of the form `${consul:a.b.c}` with the
* Creates a Preprocessor that will replace strings of the form `${consul:a.b.c}` with the
* configuration value specified by `a.b.c` from a consul service.
*
* @param url the url of the consul config service.
Expand All @@ -31,7 +31,7 @@ class ConsulConfigPreprocessor(
}

private fun fetchConsulValue(key: String): Try<String> = Try {
client.keyValueClient().getValueAsString(key).orElseThrow()
client.keyValueClient().getValueAsString(key).orElseThrow { RuntimeException("Unable to locate consul key $key") }
}

override fun handle(node: PrimitiveNode): Node = when (node) {
Expand All @@ -49,5 +49,3 @@ class ConsulConfigPreprocessor(
else -> node
}
}

data class BasicAuth(val user: String, val password: String)

0 comments on commit 26bba03

Please sign in to comment.