summaryrefslogtreecommitdiff
path: root/crashbox-server/src/main/scala/io/crashbox/ci/Core.scala
blob: 78a4252d2aab17eae60b6996a3a28221133033db (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
package io.crashbox.ci

import scala.concurrent.{Await, ExecutionContext}
import scala.concurrent.duration.Duration

import akka.actor.ActorSystem
import akka.stream.ActorMaterializer

trait Core {

  implicit val system: ActorSystem = ActorSystem("crashbox")
  implicit val materializer = ActorMaterializer()
  implicit val executionContext: ExecutionContext = system.dispatcher
  val blockingDispatcher: ExecutionContext =
    system.dispatchers.lookup("crashbox.blocking-dispatcher")

  def log = system.log
  def config = system.settings.config

  sys.addShutdownHook {
    log.info("Shutting down systm")
    Await.ready(system.terminate(), Duration.Inf)
    println("shutdown")
  }

}