-
Notifications
You must be signed in to change notification settings - Fork 18
/
Main.scala
35 lines (27 loc) · 1 KB
/
Main.scala
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
/*
* Copyright © 2021 - 2023 Swiss National Data and Service Center for the Humanities and/or DaSCH Service Platform contributors.
* SPDX-License-Identifier: Apache-2.0
*/
package org.knora.webapi
import zio._
import org.knora.webapi.core._
import org.knora.webapi.slice.infrastructure.MetricsServer
import org.knora.webapi.util.Logger
object Main extends ZIOApp {
override def environmentTag: EnvironmentTag[Environment] = EnvironmentTag[Environment]
/**
* The `Environment` that we require to exist at startup.
*/
override type Environment = LayersLive.DspEnvironmentLive
/**
* `Bootstrap` will ensure that everything is instantiated when the Runtime is created
* and cleaned up when the Runtime is shutdown.
*/
override def bootstrap: ZLayer[Any, Nothing, Environment] =
Logger.fromEnv() >>> LayersLive.dspLayersLive
/**
* Entrypoint of our Application
*/
override def run: ZIO[Environment with ZIOAppArgs with Scope, Any, Any] =
AppServer.make *> MetricsServer.make
}