Move stuff into base
This commit is contained in:
@@ -1,15 +1,10 @@
|
||||
package nl.astraeus.vst.string
|
||||
|
||||
import com.zaxxer.hikari.HikariConfig
|
||||
import io.undertow.Undertow
|
||||
import io.undertow.UndertowOptions
|
||||
import io.undertow.server.session.InMemorySessionManager
|
||||
import io.undertow.server.session.SessionAttachmentHandler
|
||||
import io.undertow.server.session.SessionCookieConfig
|
||||
import nl.astraeus.vst.string.db.Database
|
||||
import nl.astraeus.vst.base.Settings
|
||||
import nl.astraeus.vst.base.db.Database
|
||||
import nl.astraeus.vst.base.web.UndertowServer
|
||||
import nl.astraeus.vst.string.logger.LogLevel
|
||||
import nl.astraeus.vst.string.logger.Logger
|
||||
import nl.astraeus.vst.string.web.RequestHandler
|
||||
|
||||
fun main() {
|
||||
Logger.level = LogLevel.DEBUG
|
||||
@@ -18,32 +13,13 @@ fun main() {
|
||||
e.printStackTrace()
|
||||
}
|
||||
|
||||
Class.forName("nl.astraeus.jdbc.Driver")
|
||||
Settings.port = 9004
|
||||
Settings.jdbcStatsPort = 6004
|
||||
|
||||
Database.initialize(HikariConfig().apply {
|
||||
driverClassName = "nl.astraeus.jdbc.Driver"
|
||||
jdbcUrl = "jdbc:stat:webServerPort=6002:jdbc:sqlite:data/chip.db"
|
||||
username = "sa"
|
||||
password = ""
|
||||
maximumPoolSize = 25
|
||||
isAutoCommit = false
|
||||
Database.start()
|
||||
|
||||
validate()
|
||||
})
|
||||
|
||||
val sessionHandler = SessionAttachmentHandler(
|
||||
InMemorySessionManager("vst-session-manager"),
|
||||
SessionCookieConfig()
|
||||
UndertowServer.start(
|
||||
"Vst String",
|
||||
"/vst-string-worklet-ui.js"
|
||||
)
|
||||
sessionHandler.setNext(RequestHandler)
|
||||
|
||||
val server = Undertow.builder()
|
||||
.addHttpListener(Settings.port, "localhost")
|
||||
.setIoThreads(4)
|
||||
.setHandler(sessionHandler)
|
||||
.setServerOption(UndertowOptions.SHUTDOWN_TIMEOUT, 1000)
|
||||
.build()
|
||||
|
||||
println("Starting server at port ${Settings.port}...")
|
||||
server?.start()
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user