diff --git a/build.sbt b/build.sbt index 78b813d..acb2cb8 100644 --- a/build.sbt +++ b/build.sbt @@ -1,4 +1,5 @@ import org.apache.ivy.core.module.descriptor.License +import sbtassembly.{MergeStrategy, PathList} name := "http-scala-api" @@ -15,6 +16,9 @@ resolvers += Resolver.bintrayRepo("fluencelabs", "releases") scalacOptions ++= Seq("-Ypartial-unification", "-deprecation") addCompilerPlugin("com.olegpy" %% "better-monadic-for" % "0.3.0") +assemblyMergeStrategy in assembly := strategy.value + + libraryDependencies ++= Seq( fs2, fs2rx, @@ -61,3 +65,13 @@ val circeFs2 = "io.circe" %% "circe-fs2" % "0.11.0" val catsVersion = "1.6.0" val cats = "org.typelevel" %% "cats-core" % catsVersion val catsEffect = "org.typelevel" %% "cats-effect" % "1.3.0" + +val strategy = Def.setting[String => MergeStrategy]({ + // a module definition fails compilation for java 8, just skip it + case PathList("module-info.class", xs @ _*) => MergeStrategy.first + case "META-INF/io.netty.versions.properties" => MergeStrategy.first + case x => + import sbtassembly.AssemblyPlugin.autoImport.assembly + val oldStrategy = (assemblyMergeStrategy in assembly).value + oldStrategy(x) +}: String => MergeStrategy) \ No newline at end of file diff --git a/project/plugins.sbt b/project/plugins.sbt new file mode 100644 index 0000000..cd09d87 --- /dev/null +++ b/project/plugins.sbt @@ -0,0 +1,2 @@ +addSbtPlugin("com.eed3si9n" % "sbt-assembly" % "0.14.9") + diff --git a/src/main/scala/hackhack/AppRegistry.scala b/src/main/scala/hackhack/AppRegistry.scala index bc64f67..ed4a38d 100644 --- a/src/main/scala/hackhack/AppRegistry.scala +++ b/src/main/scala/hackhack/AppRegistry.scala @@ -145,7 +145,7 @@ class AppRegistry[F[_]: Monad: Concurrent: ContextShift: Timer: LiftIO]( new Exception(s"Failed to decode binary hash from base64: $e"): Throwable)) binaryPath = baseDir.resolve("binary") - _ <- fetchTo(binaryHash, binaryPath).leftMap(identity[Throwable]) + _ <- ipfsFetch(binaryHash, binaryPath).leftMap(identity[Throwable]) _ <- log(s"$name binary downloaded $binaryPath") status <- status(name, peer) @@ -244,7 +244,7 @@ class AppRegistry[F[_]: Monad: Concurrent: ContextShift: Timer: LiftIO]( max = 10 ) - private def fetchTo(hash: ByteVector, + private def ipfsFetch(hash: ByteVector, dest: Path): EitherT[F, IpfsError, Unit] = { ipfsStore .fetch(hash) diff --git a/src/main/scala/hackhack/WebsocketServer.scala b/src/main/scala/hackhack/WebsocketServer.scala index b8ff3dd..f35310a 100644 --- a/src/main/scala/hackhack/WebsocketServer.scala +++ b/src/main/scala/hackhack/WebsocketServer.scala @@ -96,7 +96,7 @@ case class WebsocketServer[F[_]: ConcurrentEffect: Timer: ContextShift]( for { exitCode <- Stream.eval(Ref[F].of(ExitCode.Success)) server <- BlazeServerBuilder[F] - .bindHttp(port) + .bindHttp(port, "0.0.0.0") .withHttpApp(CORS[F, F](routes().orNotFound, corsConfig)) .serveWhile(signal, exitCode) } yield server