Skip to content

Commit

Permalink
Import http4s uri directly
Browse files Browse the repository at this point in the history
  • Loading branch information
lenguyenthanh committed Nov 30, 2024
1 parent 10aca4b commit 02b5c7e
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 4 deletions.
5 changes: 3 additions & 2 deletions modules/app/src/main/scala/app.config.scala
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ import cats.syntax.all.*
import ciris.*
import ciris.http4s.*
import com.comcast.ip4s.*
import org.http4s.Uri
import org.http4s.implicits.*

object AppConfig:
Expand Down Expand Up @@ -39,9 +40,9 @@ object HttpServerConfig:
private def enableDocs = env("HTTP_ENABLE_DOCS").or(prop("http.enable.docs")).as[Boolean].default(false)
def config = (host, port, logger, shutdownTimeout, enableDocs).parMapN(HttpServerConfig.apply)

case class ElasticConfig(uri: org.http4s.Uri)
case class ElasticConfig(uri: Uri)

object ElasticConfig:
private def uri =
env("ELASTIC_URI").or(prop("elastic.uri")).as[org.http4s.Uri].default(uri"http://127.0.0.1:9200")
env("ELASTIC_URI").or(prop("elastic.uri")).as[Uri].default(uri"http://127.0.0.1:9200")
def config = uri.map(ElasticConfig.apply)
5 changes: 3 additions & 2 deletions modules/ingestor/src/main/scala/app.config.scala
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ import cats.effect.IO
import cats.syntax.all.*
import ciris.*
import ciris.http4s.*
import org.http4s.Uri
import org.http4s.implicits.*

import java.time.Instant
Expand Down Expand Up @@ -41,11 +42,11 @@ object MongoConfig:

def config = (uri, name, studyUri, studyDatabase).parMapN(MongoConfig.apply)

case class ElasticConfig(uri: org.http4s.Uri)
case class ElasticConfig(uri: Uri)

object ElasticConfig:
private def uri =
env("ELASTIC_URI").or(prop("elastic.uri")).as[org.http4s.Uri].default(uri"http://127.0.0.1:9200")
env("ELASTIC_URI").or(prop("elastic.uri")).as[Uri].default(uri"http://127.0.0.1:9200")
def config = uri.map(ElasticConfig.apply)

case class IngestorConfig(
Expand Down

0 comments on commit 02b5c7e

Please sign in to comment.