Skip to content

Commit

Permalink
fix: for NoSuchMethodError: void kotlin.jvm.internal.FunctionReferenc…
Browse files Browse the repository at this point in the history
…eImpl
  • Loading branch information
uglyog committed Aug 2, 2022
1 parent 05dce3c commit 14a5143
Showing 1 changed file with 11 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -159,11 +159,19 @@ object Utils : KLogging() {
* looking for an environment variable with the key, then looking for the snake-cased version of the key as an
* environment variable.
*/
@JvmOverloads
fun lookupEnvironmentValue(key: String): String? {
return lookupEnvironmentValue(key, { k: String -> System.getProperty(k) }, { k: String -> System.getenv(k) })
}

/**
* Looks up a value from the environment, first by looking for the JVM system property with the key, then
* looking for an environment variable with the key, then looking for the snake-cased version of the key as an
* environment variable.
*/
fun lookupEnvironmentValue(
key: String,
sysLookup: (key: String) -> String? = System::getProperty,
envLookup: (key: String) -> String? = System::getenv
sysLookup: (key: String) -> String?,
envLookup: (key: String) -> String?
): String? {
var value: String? = sysLookup(key)
if (value.isNullOrEmpty()) {
Expand Down

0 comments on commit 14a5143

Please sign in to comment.