mirror of
https://github.com/InsanusMokrassar/MicroUtils.git
synced 2024-11-26 03:58:45 +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 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()
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user