summaryrefslogtreecommitdiff
path: root/crashbox-server/src/main/scala/io/crashbox/ci/Main.scala
diff options
context:
space:
mode:
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.scala24
1 files changed, 15 insertions, 9 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 0187751..d2e886b 100644
--- a/crashbox-server/src/main/scala/io/crashbox/ci/Main.scala
+++ b/crashbox-server/src/main/scala/io/crashbox/ci/Main.scala
@@ -1,6 +1,9 @@
package io.crashbox.ci
+import akka.http.scaladsl.Http
+import akka.stream.ActorMaterializer
import java.net.URL
+import scala.util.{Failure, Success}
object Main
extends Core
@@ -8,19 +11,22 @@ object Main
with Builders
with Parsers
with Source
- with StreamStore {
+ with StreamStore
+ with HttpApi {
def main(args: Array[String]): Unit = {
reapDeadBuilds()
- start(
- "random_build",
- new URL("file:///home/jodersky/tmp/dummy"),
- () => saveStream("random_build"),
- state => println(state)
- )
- Thread.sleep(15000)
- System.exit(0)
+ val host = system.settings.config.getString("crashbox.host")
+ val port = system.settings.config.getInt("crashbox.port")
+
+ Http(system).bindAndHandle(httpApi, host, port) onComplete {
+ case Success(_) =>
+ system.log.info(s"Listening on $host:$port")
+ case Failure(ex) =>
+ system.log.error(ex, s"Failed to bind to $host:$port")
+ system.terminate()
+ }
}
}