mirror of
https://github.com/InsanusMokrassar/MicroUtils.git
synced 2024-11-22 16:23:50 +00:00
Update ServerLauncher.kt
This commit is contained in:
parent
c9514d3a6d
commit
2a4570eafc
@ -10,15 +10,23 @@ import org.koin.core.module.Module
|
|||||||
import org.koin.dsl.module
|
import org.koin.dsl.module
|
||||||
import java.io.File
|
import java.io.File
|
||||||
|
|
||||||
|
package dev.inmo.micro_utils.startup.launcher
|
||||||
|
|
||||||
|
import dev.inmo.
|
||||||
|
|
||||||
|
class ServerLauncher : ServerPlugin {
|
||||||
|
val defaultJson = Json {
|
||||||
|
ignoreUnknownKeys = true
|
||||||
|
}
|
||||||
|
|
||||||
suspend fun main(args: Array<String>) {
|
suspend fun main(args: Array<String>) {
|
||||||
|
|
||||||
KSLog.default = KSLog("PlaguBot")
|
KSLog.default = KSLog("PlaguBot")
|
||||||
val (configPath) = args
|
val (configPath) = args
|
||||||
val file = File(configPath)
|
val file = File(configPath)
|
||||||
KSLog.i("Start read config from ${file.absolutePath}")
|
KSLog.i("Start read config from ${file.absolutePath}")
|
||||||
val json = defaultJsonFormat.parseToJsonElement(file.readText()).jsonObject
|
val json = defaultJson.parseToJsonElement(file.readText()).jsonObject
|
||||||
val config = defaultJsonFormat.decodeFromJsonElement(Config.serializer(), json)
|
|
||||||
KSLog.i("Config has been read")
|
KSLog.i("Config has been read")
|
||||||
|
|
||||||
PlaguBot(json, config).start().join()
|
ServerLauncher.start().join()
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user