kodeshare/src/main/kotlin/moe/kageru/kodeshare/config/Config.kt

28 lines
762 B
Kotlin
Raw Normal View History

2019-09-29 08:17:31 +02:00
package moe.kageru.kodeshare.config
import com.uchuhimo.konf.Config
import com.uchuhimo.konf.ConfigSpec
2019-09-29 09:51:15 +02:00
val config = Config {
addSpec(DatabaseSpec)
addSpec(ServerSpec)
}.from.properties.file("kodeshare.properties")
2019-09-29 08:17:31 +02:00
.from.env()
object DatabaseSpec : ConfigSpec() {
val port by optional(3306)
val password by required<String>()
val user by optional("kodeshare")
val database by optional("kode")
2019-09-29 09:51:15 +02:00
}
object ServerSpec : ConfigSpec() {
val port by optional(9092)
// For the AboutPage.
// No protocol or trailing slash is added.
2019-09-29 11:50:14 +02:00
val domain by required<String>()
// This is needed to return full URLs when uploading via curl.
// Will use the domain above if unspecified.
val pasteurl by optional<String>("")
2019-09-29 17:18:38 +02:00
}