-
-
Notifications
You must be signed in to change notification settings - Fork 22
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
22b0f0f
commit 0f1783a
Showing
3 changed files
with
104 additions
and
1 deletion.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,41 @@ | ||
package lila.search | ||
package app | ||
|
||
import cats.effect.IO | ||
import cats.syntax.all._ | ||
import ciris._ | ||
import ciris.http4s._ | ||
import com.comcast.ip4s._ | ||
|
||
object AppConfig { | ||
|
||
def load: IO[AppConfig] = appConfig.load[IO] | ||
|
||
def appConfig = ( | ||
HttpServerConfig.config, | ||
ElasticConfig.config | ||
).parMapN(AppConfig.apply) | ||
|
||
} | ||
|
||
case class AppConfig( | ||
server: HttpServerConfig, | ||
elastic: ElasticConfig | ||
) | ||
|
||
case class HttpServerConfig(host: Host, port: Port, shutdownTimeout: Int) | ||
|
||
object HttpServerConfig { | ||
private def host = env("HTTP_HOST").or(prop("http.host")).as[Host].default(ip"0.0.0.0") | ||
private def port = env("HTTP_PORT").or(prop("http.port")).as[Port].default(port"9669") | ||
private def shutdownTimeout = | ||
env("HTTP_SHUTDOWN_TIMEOUT").or(prop("http.shutdown.timeout")).as[Int].default(30) | ||
def config = (host, port, shutdownTimeout).parMapN(HttpServerConfig.apply) | ||
} | ||
|
||
case class ElasticConfig(uri: String) | ||
|
||
object ElasticConfig { | ||
private def uri = env("ELASTIC_URI").or(prop("elastic.uri")).as[String] | ||
def config = uri.map(ElasticConfig.apply) | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,41 @@ | ||
import sbt.* | ||
|
||
object Dependencies { | ||
|
||
object V { | ||
val catsEffect = "3.5.4" | ||
val ciris = "3.5.0" | ||
val fs2 = "3.10.2" | ||
val http4s = "0.23.27" | ||
val iron = "2.5.0" | ||
} | ||
|
||
def http4s(artifact: String) = "org.http4s" %% s"http4s-$artifact" % V.http4s | ||
|
||
val catsCore = "org.typelevel" %% "cats-core" % "2.10.0" | ||
val catsEffect = "org.typelevel" %% "cats-effect" % V.catsEffect | ||
|
||
val fs2 = "co.fs2" %% "fs2-core" % V.fs2 | ||
val fs2IO = "co.fs2" %% "fs2-io" % V.fs2 | ||
|
||
val cirisCore = "is.cir" %% "ciris" % V.ciris | ||
val cirisHtt4s = "is.cir" %% "ciris-http4s" % V.ciris | ||
val iron = "io.github.iltotore" %% "iron" % V.iron | ||
val ironCiris = "io.github.iltotore" %% "iron-ciris" % V.iron | ||
|
||
val http4sServer = http4s("ember-server") | ||
val http4sClient = http4s("client") | ||
val http4sEmberClient = http4s("ember-client") | ||
|
||
val log4Cats = "org.typelevel" %% "log4cats-slf4j" % "2.7.0" | ||
val logbackX = "ch.qos.logback" % "logback-classic" % "1.5.6" | ||
|
||
val ducktape = "io.github.arainko" %% "ducktape" % "0.2.0" | ||
|
||
|
||
val testContainers = "com.dimafeng" %% "testcontainers-scala-postgresql" % "0.41.3" % Test | ||
val weaver = "com.disneystreaming" %% "weaver-cats" % "0.8.4" % Test | ||
val weaverScalaCheck = "com.disneystreaming" %% "weaver-scalacheck" % "0.8.4" % Test | ||
val catsEffectTestKit = "org.typelevel" %% "cats-effect-testkit" % V.catsEffect % Test | ||
val scalacheck = "org.scalacheck" %% "scalacheck" % "1.17.0" % Test | ||
} |