fix findSpecConfigFromResource
This commit is contained in:
parent
894cfefa12
commit
5f956ab42c
1 changed files with 2 additions and 2 deletions
|
@ -18,14 +18,14 @@ internal fun findSpecConfigFromFile(file: ConfigFileName? = null): Result<SpecCo
|
||||||
// provide default config
|
// provide default config
|
||||||
writeSpecConfigToFile(filePath, SpecConfig(listOf(CommandSpec("echo just_for_demo", "just_for_demo"))))
|
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 {
|
internal fun findSpecConfigFromResource(resourcePath: String): Result<SpecConfig> = runCatching {
|
||||||
val resource = Thread.currentThread().contextClassLoader.getResource(resourcePath)
|
val resource = Thread.currentThread().contextClassLoader.getResource(resourcePath)
|
||||||
requireNotNull(resource) { "Resource $resourcePath not found" }
|
requireNotNull(resource) { "Resource $resourcePath not found" }
|
||||||
return resource.readText().yamlToType()
|
resource.readText().yamlToType()
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue