@@ -20,7 +20,6 @@ import java.io.File
20
20
21
21
import akka .actor .ActorSystem
22
22
import akka .http .scaladsl .Http
23
- import akka .http .scaladsl .server .Route
24
23
import akka .stream .BindFailedException
25
24
import fr .acinq .eclair .api .Service
26
25
import grizzled .slf4j .Logging
@@ -51,9 +50,9 @@ object Boot extends App with Logging {
51
50
plugins.foreach(_.onSetup(setup))
52
51
setup.bootstrap onComplete {
53
52
case Success (kit) =>
53
+ plugins.foreach(_.onKit(kit))
54
54
val routeProviderPlugins = plugins.collect { case plugin : RouteProvider => plugin }
55
55
startApiServiceIfEnabled(kit, routeProviderPlugins)
56
- plugins.foreach(_.onKit(kit))
57
56
case Failure (t) => onError(t)
58
57
}
59
58
} catch {
@@ -80,8 +79,7 @@ object Boot extends App with Logging {
80
79
override val password : String = apiPassword
81
80
override val eclairApi : Eclair = new EclairImpl (kit)
82
81
}
83
- val pluginRoutes = providers.map(_.route(service))
84
- Http ().bindAndHandle(service.finalRoutes(pluginRoutes), config.getString(" api.binding-ip" ), config.getInt(" api.port" )).recover {
82
+ Http ().newServerAt(config.getString(" api.binding-ip" ), config.getInt(" api.port" )).bindFlow(service.finalRoutes(providers)).recover {
85
83
case _ : BindFailedException => onError(TCPBindException (config.getInt(" api.port" )))
86
84
}
87
85
} else {
0 commit comments