28 lines
762 B
Kotlin
28 lines
762 B
Kotlin
package moe.kageru.kodeshare.config
|
|
|
|
import com.uchuhimo.konf.Config
|
|
import com.uchuhimo.konf.ConfigSpec
|
|
|
|
val config = Config {
|
|
addSpec(DatabaseSpec)
|
|
addSpec(ServerSpec)
|
|
}.from.properties.file("kodeshare.properties")
|
|
.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")
|
|
}
|
|
|
|
object ServerSpec : ConfigSpec() {
|
|
val port by optional(9092)
|
|
// For the AboutPage.
|
|
// No protocol or trailing slash is added.
|
|
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>("")
|
|
}
|