Print addresses the server listens on

This commit is contained in:
Alexandre Archambault 2016-05-09 19:20:10 +02:00
parent 774a599bdd
commit 9b66d5a2ec
No known key found for this signature in database
GPG Key ID: 14640A6839C263A9
1 changed files with 11 additions and 1 deletions

View File

@ -1,6 +1,7 @@
package coursier
import java.io.{ File, FileOutputStream }
import java.net.NetworkInterface
import java.nio.channels.{ FileLock, OverlappingFileLockException }
import org.http4s.dsl._
@ -11,6 +12,8 @@ import org.http4s.{ BasicCredentials, Challenge, EmptyBody, Request, Response }
import caseapp._
import scala.collection.JavaConverters._
import scalaz.concurrent.Task
case class SimpleHttpServerApp(
@ -200,9 +203,16 @@ case class SimpleHttpServerApp(
b
}
if (verbosityLevel >= 0)
if (verbosityLevel >= 0) {
Console.err.println(s"Listening on http://$host:$port")
if (verbosityLevel >= 1 && host == "0.0.0.0") {
Console.err.println(s"Listening on addresses")
for (itf <- NetworkInterface.getNetworkInterfaces.asScala; addr <- itf.getInetAddresses.asScala)
Console.err.println(s" ${addr.getHostAddress} (${itf.getName})")
}
}
builder
.run
.awaitShutdown()