org.http4k.config.Authority.kt Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of http4k-config Show documentation
Show all versions of http4k-config Show documentation
Machinery for configuring Http4k apps in a typesafe way
package org.http4k.config
data class Authority(val host: Host, val port: Port? = null) {
override fun toString() = host.value + (port?.let { ":${it.value}" }.orEmpty())
companion object {
operator fun invoke(value: String) = with(value.split(":")) {
when (size) {
1 -> Authority(Host(this[0]), null)
2 -> Authority(Host(this[0]), Port(this[1].toInt()))
else -> throw IllegalArgumentException("Could not construct Authority from $value")
}
}
}
}
© 2015 - 2025 Weber Informatics LLC | Privacy Policy