Feature / Configuration improvements
I had a go at adding a yaml loader via the Arkenv::loaders
prop.
What I found is that there is no easy way to dynamically specify what file to load the yaml from.
@Test fun `yaml example`() {
val ark = object : Ark() {
val name: String by argument("--name")
}
@Language("yaml")
val yaml = """
port: 99
name: hello world
""".trimIndent()
ark.loaders.add {
val map = (Yaml().load(yaml) as Map<String, Any>)
.map { (key, value) -> key.toUpperCase() to value.toString() }
it.dotEnv.putAll(map)
}
ark.parse(arrayOf()).expectThat {
get { port }.isEqualTo(99)
get { name }.isEqualTo("hello world")
}
}
Have to find a way to make feature registration convenient.
It would be great if both the env related props like withEnv
could be configured via a feature instead of via constructor.
Edited by Andreas Volkmann