Skip to content

Commit

Permalink
Fix warning
Browse files Browse the repository at this point in the history
  • Loading branch information
To-om committed Dec 15, 2020
1 parent a06f056 commit 258edde
Showing 1 changed file with 16 additions and 18 deletions.
34 changes: 16 additions & 18 deletions thehive/test/org/thp/thehive/DevStart.scala
Original file line number Diff line number Diff line change
Expand Up @@ -6,26 +6,24 @@ import play.api._
import play.core.server.{RealServerProcess, ServerConfig, ServerProcess, ServerProvider}

object DevStart extends App {
override def main(args: Array[String]): Unit = {
val process = new RealServerProcess(args)
val config = readConfig(process)

val application: Application = {
val environment = Environment(config.rootDir, process.classLoader, Mode.Dev)
val context = ApplicationLoader.Context.create(environment)
val loader = ApplicationLoader(context)
loader.load(context)
}
Play.start(application)
val process = new RealServerProcess(args)
val config = readConfig(process)

val application: Application = {
val environment = Environment(config.rootDir, process.classLoader, Mode.Dev)
val context = ApplicationLoader.Context.create(environment)
val loader = ApplicationLoader(context)
loader.load(context)
}
Play.start(application)

// Start the server
val serverProvider = ServerProvider.fromConfiguration(process.classLoader, config.configuration)
val server = serverProvider.createServer(config, application)
// Start the server
val serverProvider = ServerProvider.fromConfiguration(process.classLoader, config.configuration)
val server = serverProvider.createServer(config, application)

process.addShutdownHook {
if (application.coordinatedShutdown.shutdownReason().isEmpty)
server.stop()
}
process.addShutdownHook {
if (application.coordinatedShutdown.shutdownReason().isEmpty)
server.stop()
}

def readConfig(process: ServerProcess) = {
Expand Down

0 comments on commit 258edde

Please sign in to comment.