diff options
author | Jakob Odersky <jakob@odersky.com> | 2017-03-18 01:58:01 -0400 |
---|---|---|
committer | Jakob Odersky <jakob@odersky.com> | 2017-03-18 01:58:01 -0400 |
commit | dff97b40df39e5eb391e1fc30ca47180384f1747 (patch) | |
tree | 76d1a4d3af4c8a0b8b316a151d40493e8f22957b /crashbox-server/src/main/scala/io/crashbox/ci/Main.scala | |
parent | 3f00b87a022e92e3bf341d40d05d81b5538e4974 (diff) | |
download | crashbox-ci-nocake.tar.gz crashbox-ci-nocake.tar.bz2 crashbox-ci-nocake.zip |
Refactor trait-based dependencies to constructor parametersnocake
Diffstat (limited to 'crashbox-server/src/main/scala/io/crashbox/ci/Main.scala')
-rw-r--r-- | crashbox-server/src/main/scala/io/crashbox/ci/Main.scala | 24 |
1 files changed, 13 insertions, 11 deletions
diff --git a/crashbox-server/src/main/scala/io/crashbox/ci/Main.scala b/crashbox-server/src/main/scala/io/crashbox/ci/Main.scala index 55971b1..ae9499d 100644 --- a/crashbox-server/src/main/scala/io/crashbox/ci/Main.scala +++ b/crashbox-server/src/main/scala/io/crashbox/ci/Main.scala @@ -6,22 +6,24 @@ import akka.http.scaladsl.Http import scala.concurrent._ import scala.concurrent.duration._ -object Main - extends Core - with Schedulers - with Storage - with Executors - with Parsers - with Source - with HttpApi { +object Main { + + implicit val core = new Core() + import core._ + + val storage = new Storage() + val executor = new DockerExecutor + val scheduler = new Scheduler(executor, storage) + val api = new HttpApi(scheduler, storage) + def main(args: Array[String]): Unit = { - reapDeadBuilds() - Await.result(setupDatabase(), 10.seconds) + executor.reapDeadBuilds() + Await.result(storage.setupDatabase(), 10.seconds) val host = config.getString("crashbox.host") val port = config.getInt("crashbox.port") - Http(system).bindAndHandle(httpApi, host, port) onComplete { + Http(system).bindAndHandle(api.httpApi, host, port) onComplete { case Success(_) => log.info(s"Listening on $host:$port") case Failure(ex) => |