Skip to content

Commit

Permalink
Start Server after routes are defined (#881)
Browse files Browse the repository at this point in the history
* Start Server after routes are defined

* Separate events
  • Loading branch information
Syer10 authored Feb 19, 2024
1 parent b18c155 commit 525a974
Showing 1 changed file with 10 additions and 6 deletions.
16 changes: 10 additions & 6 deletions server/src/main/kotlin/suwayomi/tachidesk/server/JavalinSetup.kt
Original file line number Diff line number Diff line change
Expand Up @@ -106,13 +106,15 @@ object JavalinSetup {
handler.handle(ctx)
}
}
}.events { event ->
event.serverStarted {
if (serverConfig.initialOpenInBrowserEnabled.value) {
Browser.openInBrowser()
}
}

app.events { event ->
event.serverStarted {
if (serverConfig.initialOpenInBrowserEnabled.value) {
Browser.openInBrowser()
}
}.start()
}
}

// when JVM is prompted to shutdown, stop javalin gracefully
Runtime.getRuntime().addShutdownHook(
Expand Down Expand Up @@ -150,6 +152,8 @@ object JavalinSetup {
GraphQL.defineEndpoints()
}
}

app.start()
}

private fun getOpenApiOptions(): OpenApiOptions {
Expand Down

0 comments on commit 525a974

Please sign in to comment.