diff options
author | Zach Smith <zach@driver.xyz> | 2017-11-07 10:16:30 -0800 |
---|---|---|
committer | Zach Smith <zach@driver.xyz> | 2017-11-07 10:16:30 -0800 |
commit | 95916bf2a9c473debcc173be6d2ac57850e06703 (patch) | |
tree | 74f1bfca45c6b21f1153f6469ceda511d73c9a1e | |
parent | 101c451480649c6d4aa8efb0294adf439512f8be (diff) | |
download | driver-core-95916bf2a9c473debcc173be6d2ac57850e06703.tar.gz driver-core-95916bf2a9c473debcc173be6d2ac57850e06703.tar.bz2 driver-core-95916bf2a9c473debcc173be6d2ac57850e06703.zip |
Add default headers to basic routes defined in DriverApp
-rw-r--r-- | src/main/scala/xyz/driver/core/app/DriverApp.scala | 7 |
1 files changed, 6 insertions, 1 deletions
diff --git a/src/main/scala/xyz/driver/core/app/DriverApp.scala b/src/main/scala/xyz/driver/core/app/DriverApp.scala index 751bef7..4b9fcf6 100644 --- a/src/main/scala/xyz/driver/core/app/DriverApp.scala +++ b/src/main/scala/xyz/driver/core/app/DriverApp.scala @@ -44,6 +44,7 @@ class DriverApp(appName: String, scheme: String = "http", port: Int = 8080, tracer: Tracer = NoTracer)(implicit actorSystem: ActorSystem, executionContext: ExecutionContext) { + self => import DriverApp._ implicit private lazy val materializer: ActorMaterializer = ActorMaterializer()(actorSystem) @@ -74,7 +75,11 @@ class DriverApp(appName: String, val swaggerService = swaggerOverride(serviceTypes) val swaggerRoute = swaggerService.routes ~ swaggerService.swaggerUI val versionRt = versionRoute(version, gitHash, time.currentTime()) - val combinedRoute = modules.map(_.route).foldLeft(versionRt ~ healthRoute ~ swaggerRoute)(_ ~ _) + val basicRoutes = new DriverRoute { + override def log: Logger = self.log + override def route: Route = versionRt ~ healthRoute ~ swaggerRoute + } + val combinedRoute = modules.map(_.route).foldLeft(basicRoutes.routeWithDefaults)(_ ~ _) (extractHost & extractClientIP & trace(tracer)) { case (origin, ip) => |