You cannot select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
38 lines
1.2 KiB
Kotlin
38 lines
1.2 KiB
Kotlin
package me.eater.hefbrug
|
|
|
|
import kotlinx.coroutines.runBlocking
|
|
import me.eater.hefbrug.executor.ExecutionInstance
|
|
import me.eater.hefbrug.executor.Executor
|
|
import me.eater.hefbrug.logging.LoggerConfig
|
|
import me.eater.hefbrug.node.Node
|
|
import org.apache.logging.log4j.kotlin.loggerOf
|
|
import java.nio.file.Paths
|
|
import java.time.Instant
|
|
|
|
object Main {
|
|
@JvmStatic
|
|
fun main(args: Array<String>) {
|
|
System.setProperty("log4j2.configurationFactory", LoggerConfig::class.qualifiedName!!)
|
|
System.setProperty("log4j.skipJansi", "false")
|
|
val logger = loggerOf(this.javaClass)
|
|
logger.info("Booting hefbrug")
|
|
logger.info("Compiling configuration")
|
|
val start = Instant.now()
|
|
val scope = Executor().apply {
|
|
run(Paths.get(args[0]).toAbsolutePath().toString())
|
|
}
|
|
.getScope()
|
|
|
|
val end = Instant.now()
|
|
logger.info("Compiled configuration in ${end.epochSecond - start.epochSecond}s")
|
|
|
|
runBlocking {
|
|
val executionInstance = ExecutionInstance.forNode(
|
|
Node(Runtime.getRuntime().exec("hostname").inputStream.bufferedReader().readText().trim()),
|
|
scope
|
|
)
|
|
|
|
executionInstance.apply(false)
|
|
}
|
|
}
|
|
} |