Update ServerLauncher.kt

This commit is contained in:
InsanusMokrassar 2022-12-05 21:52:36 +06:00 committed by GitHub
parent c9514d3a6d
commit 2a4570eafc
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 11 additions and 3 deletions

View File

@ -10,15 +10,23 @@ import org.koin.core.module.Module
import org.koin.dsl.module
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>) {
KSLog.default = KSLog("PlaguBot")
val (configPath) = args
val file = File(configPath)
KSLog.i("Start read config from ${file.absolutePath}")
val json = defaultJsonFormat.parseToJsonElement(file.readText()).jsonObject
val config = defaultJsonFormat.decodeFromJsonElement(Config.serializer(), json)
val json = defaultJson.parseToJsonElement(file.readText()).jsonObject
KSLog.i("Config has been read")
PlaguBot(json, config).start().join()
ServerLauncher.start().join()
}