fix findSpecConfigFromResource

This commit is contained in:
ansgarz 2022-03-26 18:26:13 +01:00
parent 894cfefa12
commit 5f956ab42c

View file

@ -18,14 +18,14 @@ internal fun findSpecConfigFromFile(file: ConfigFileName? = null): Result<SpecCo
// provide default config
writeSpecConfigToFile(filePath, SpecConfig(listOf(CommandSpec("echo just_for_demo", "just_for_demo"))))
}
readFromFile(filePath).yamlToType()
readFromFile(filePath).yamlToType<SpecConfig>()
}
internal fun findSpecConfigFromResource(resourcePath: String): Result<SpecConfig> = runCatching {
val resource = Thread.currentThread().contextClassLoader.getResource(resourcePath)
requireNotNull(resource) { "Resource $resourcePath not found" }
return resource.readText().yamlToType()
resource.readText().yamlToType()
}