Skip to content

Commit

Permalink
Change redis host
Browse files Browse the repository at this point in the history
  • Loading branch information
mmvpm committed May 4, 2024
1 parent 0e408e7 commit 2cc87ba
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 2 deletions.
2 changes: 1 addition & 1 deletion service/src/main/resources/application.conf
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ postgresql {
session.expiration = 3 hours

redis {
host = "c-c9q732q662jhu4sn3e94.rw.mdb.yandexcloud.net"
host = "c-c9qhoa8bt19q7df1o5qi.rw.mdb.yandexcloud.net"
port = 6379
password = "redis111"
}
9 changes: 8 additions & 1 deletion service/src/main/scala/com/github/mmvpm/service/Main.scala
Original file line number Diff line number Diff line change
Expand Up @@ -27,13 +27,14 @@ import sttp.tapir.swagger.bundle.SwaggerInterpreter
object Main extends IOApp {

override def run(args: List[String]): IO[ExitCode] = {
val config = ConfigSource.default.loadOrThrow[Config]
val config = ConfigSource.resources(getConfigName(args)).loadOrThrow[Config]
makeTransactor[IO](config.postgresql).use(runServer(config)(_))
}

private def runServer(config: Config)(implicit xa: Transactor[IO]): IO[ExitCode] =
for {
random <- Random.scalaUtilRandom[IO]

redis = new RedisClient(config.redis.host, config.redis.port, secret = config.redis.password)

offerDao: OfferDao[IO] = new OfferDaoPostgresql[IO]
Expand Down Expand Up @@ -75,4 +76,10 @@ object Main extends IOApp {

private def swaggerBy[A](endpoints: List[ServerEndpoint[A, IO]]): List[ServerEndpoint[A, IO]] =
SwaggerInterpreter().fromServerEndpoints[IO](endpoints, "offers-service", "1.0.0")

private def getConfigName(args: List[String]): String =
args match {
case "local" :: _ => "application-local.conf"
case _ => "application.conf"
}
}

0 comments on commit 2cc87ba

Please sign in to comment.