Skip to content

Commit

Permalink
Use IOApp.Simple
Browse files Browse the repository at this point in the history
  • Loading branch information
usommerl committed Aug 2, 2024
1 parent 465f0d6 commit 66d9156
Showing 1 changed file with 4 additions and 5 deletions.
9 changes: 4 additions & 5 deletions src/main/scala/app/Main.scala
Original file line number Diff line number Diff line change
Expand Up @@ -10,17 +10,16 @@ import io.odin.*
import org.http4s.ember.server.EmberServerBuilder
import org.http4s.server.{middleware, Server}

object Main extends IOApp {
object Main extends IOApp.Simple {

def run(args: List[String]): IO[ExitCode] =
app.config.resource[IO].flatMap(runF[IO](_, FunctionK.id)).useForever
def run: IO[Unit] = app.config.resource[IO].flatMap(runF[IO](_, FunctionK.id)).useForever

def runF[F[_]: Async: Network](config: Config, functionK: F ~> IO): Resource[F, Unit] =
for {
for
logger <- makeLogger[F](config.logger, functionK)
_ <- Resource.eval(logger.info(startMessage))
_ <- makeServer[F](config.server)
} yield ()
yield ()

private def makeLogger[F[_]: Async](config: LoggerConfig, functionK: F ~> IO): Resource[F, Logger[F]] =
Resource
Expand Down

0 comments on commit 66d9156

Please sign in to comment.