my own quick hack while waiting: ``` class MyAppli...
# ktor
m
my own quick hack while waiting:
Copy code
class MyApplicationConfig : ApplicationConfig {
    val properties:MutableMap<String,ApplicationConfigValue> = mutableMapOf()
    override fun config(path: String): ApplicationConfig {
        throw UnsupportedOperationException("not implemented") //To change body of created functions use File | Settings | File Templates.
    }

    override fun configList(path: String): List<ApplicationConfig> {
        throw UnsupportedOperationException("not implemented") //To change body of created functions use File | Settings | File Templates.
    }

    override fun property(path: String): ApplicationConfigValue {
        return properties.get(path)?:throw IllegalArgumentException("Unknown property $path")
    }

    override fun propertyOrNull(path: String): ApplicationConfigValue? {
        return properties.get(path)
    }

    fun put(path: String,value: ApplicationConfigValue){
        properties.put(path, value)
    }

    fun putSingle(property: Pair<String, String>) {
        properties.putAll(listOf(property.let { Pair(it.first, SingleApplicationConfigValue(it.second)) }))
    }

    fun putList(property: Pair<String, List<String>>) {
        properties.putAll(listOf(property.let { Pair(it.first, ListApplicationConfigValue(it.second)) }))
    }

    class SingleApplicationConfigValue(val value:String):ApplicationConfigValue{
        override fun getString(): String {
            return value
        }

        override fun getList(): List<String> {
            throw UnsupportedOperationException("A single value is not a list")
        }
    }

    class ListApplicationConfigValue(val value:List<String>):ApplicationConfigValue{
        override fun getString(): String {
            throw UnsupportedOperationException("A list value is not a single value")
        }

        override fun getList(): List<String> {
            return value
        }
    }
}