Skip to content

Commit

Permalink
Update deploy config and add default config
Browse files Browse the repository at this point in the history
  • Loading branch information
lenguyenthanh committed Nov 23, 2023
1 parent cdd5f1a commit efcf1f7
Show file tree
Hide file tree
Showing 4 changed files with 13 additions and 12 deletions.
4 changes: 2 additions & 2 deletions .env
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,8 @@ REDIS_HOST=127.0.0.1
REDIS_PORT=6379

# http server
HTTP_SERVER_HOST=0.0.0.0
HTTP_SERVER_PORT=9665
HTTP_HOST=0.0.0.0
HTTP_PORT=9665

# kamon
KAMON_ENABLED=true
10 changes: 5 additions & 5 deletions app/src/main/scala/Config.scala
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ package lila.fishnet
import cats.syntax.all.*
import ciris.*
import ciris.http4s.*
import com.comcast.ip4s.{ Host, Port }
import com.comcast.ip4s.*
import cats.effect.IO

object Config:
Expand All @@ -21,15 +21,15 @@ case class AppConfig(redis: RedisConfig, server: HttpServerConfig, kamon: KamonC
case class HttpServerConfig(host: Host, port: Port)

object HttpServerConfig:
def host = env("HTTP_SERVER_HOST").or(prop("http.server.host")).as[Host]
def port = env("HTTP_SERVER_PORT").or(prop("http.server.port")).as[Port]
def host = env("HTTP_HOST").or(prop("http.host")).as[Host].default(ip"127.0.0.1")
def port = env("HTTP_PORT").or(prop("http.port")).as[Port].default(port"9665")
def config = (host, port).parMapN(HttpServerConfig.apply)

case class RedisConfig(host: Host, port: Port)

object RedisConfig:
private def host = env("REDIS_HOST").or(prop("redis.host")).as[Host]
private def port = env("REDIS_PORT").or(prop("redis.port")).as[Port]
private def host = env("REDIS_HOST").or(prop("redis.host")).as[Host].default(ip"127.0.0.1")
private def port = env("REDIS_PORT").or(prop("redis.port")).as[Port].default(port"6379")
def config = (host, port).parMapN(RedisConfig.apply)

case class KamonConfig(enabled: Boolean)
Expand Down
7 changes: 4 additions & 3 deletions build.sbt
Original file line number Diff line number Diff line change
Expand Up @@ -5,13 +5,14 @@ inThisBuild(
scalaVersion := "3.3.1",
versionScheme := Some("early-semver"),
version := "3.0",
run / fork := true,
run / fork := true
)
)

lazy val app = project
.in(file("app"))
.settings(
name := "lila-fishnet",
scalacOptions -= "-Xfatal-warnings",
scalacOptions ++= Seq("-source:future", "-rewrite", "-indent", "-explain", "-Wunused:all", "-release:21"),
resolvers ++= Seq(Dependencies.lilaMaven),
Expand Down Expand Up @@ -40,8 +41,8 @@ lazy val app = project
munitScalacheck,
weaver,
weaverScalaCheck,
circeLiteral,
),
circeLiteral
)
)
.enablePlugins(JavaAppPackaging)

Expand Down
4 changes: 2 additions & 2 deletions deploy.sh
Original file line number Diff line number Diff line change
Expand Up @@ -24,8 +24,8 @@ RSYNC_OPTIONS=" \
--exclude RUNNING_PID \
--exclude '.git/'"

stage="target/universal/stage"
include="$stage/bin $stage/lib $stage/conf"
stage="app/target/universal/stage"
include="$stage/bin $stage/lib"
rsync_command="rsync $RSYNC_OPTIONS $include $REMOTE:$REMOTE_DIR"
echo "$rsync_command"
$rsync_command
Expand Down

0 comments on commit efcf1f7

Please sign in to comment.