Skip to content

Instantly share code, notes, and snippets.

@Algiras
Created February 10, 2020 12:51
Show Gist options
  • Save Algiras/0a71fe67a66aa3974c50a41ede454910 to your computer and use it in GitHub Desktop.
Save Algiras/0a71fe67a66aa3974c50a41ede454910 to your computer and use it in GitHub Desktop.
def run(args: List[String]): IO[ExitCode] = (for {
config <- loadConfigF[IO, Config]
userCredentialStore <- UserStore(config.users.head, config.users.tail: _*)
http <- httpApp(userCredentialStore)
res <- BlazeServerBuilder[IO]
.bindHttp(host = config.http.host, port = config.http.port.getOrElse(0))
.withHttpApp(http)
.serve
.compile
.drain
.map(_ => ExitCode.Success)
} yield res).handleError(_ => ExitCode.Error)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment