-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* fix(all): redo the initial architecture layout * fix(README): make `pre-push` executable * fix(githooks): include tests in the `pre-push` script * fix(Docker): use `.gitignore` & use `build.properties` & use `sbt-1.9.6` & use `Maven` repository * refactor(all): clean `Dockerfile` & clean `build.sbt` & remove `.env` example
- Loading branch information
1 parent
5df8b4b
commit 336111d
Showing
24 changed files
with
160 additions
and
45 deletions.
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,40 @@ | ||
# Ignore SBT and IDE-specific files | ||
.metals/ | ||
.metals.sbt | ||
.bloop/ | ||
.vscode/ | ||
.idea/ | ||
|
||
# Ignore OS-specific files | ||
.DS_Store | ||
Thumbs.db | ||
|
||
# Ignore build and target directories | ||
target/ | ||
project/target/ | ||
project/.bloop/ | ||
project/.metals/ | ||
project/**/target/ | ||
|
||
# Ignore local caches | ||
.coursier/ | ||
.ivy2/ | ||
.sbt/ | ||
|
||
# Ignore logs and temporary files | ||
logs/ | ||
*.log | ||
tmp/ | ||
task-temp-directory/ | ||
|
||
# Ignore example files and test results | ||
examples/ | ||
test-reports/ | ||
|
||
# Ignore git and version control files | ||
.git/ | ||
.gitignore | ||
|
||
# Ignore any sensitive files (if applicable) | ||
.env | ||
secrets/ |
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 |
---|---|---|
|
@@ -4,7 +4,6 @@ | |
target/ | ||
project/target/ | ||
project/project/ | ||
project/build* | ||
project/metals* | ||
.vscode/ | ||
|
||
|
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
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 was deleted.
Oops, something went wrong.
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 @@ | ||
sbt.version=1.9.6 |
4 changes: 2 additions & 2 deletions
4
src/main/scala/resource/api/Endpoints.scala → src/main/scala/api/Endpoints.scala
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
2 changes: 1 addition & 1 deletion
2
...ain/scala/resource/api/ErrorHandler.scala → src/main/scala/api/ErrorHandler.scala
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 |
---|---|---|
@@ -1,4 +1,4 @@ | ||
package resource.api | ||
package api | ||
|
||
import cats.effect.IO | ||
import org.http4s._ | ||
|
2 changes: 1 addition & 1 deletion
2
...in/scala/resource/api/ServerBuilder.scala → src/main/scala/api/ServerBuilder.scala
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 |
---|---|---|
@@ -1,4 +1,4 @@ | ||
package resource.api | ||
package api | ||
|
||
import cats.effect.{IO, Resource} | ||
import com.comcast.ip4s.{Host, Port} | ||
|
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
File renamed without changes.
2 changes: 1 addition & 1 deletion
2
...la/resource/core/domain/Interactant.scala → src/main/scala/core/domain/Interactant.scala
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
File renamed without changes.
2 changes: 1 addition & 1 deletion
2
...scala/resource/core/domain/Reaction.scala → src/main/scala/core/domain/Reaction.scala
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
File renamed without changes.
File renamed without changes.
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 was deleted.
Oops, something went wrong.
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,54 @@ | ||
package config | ||
|
||
import com.comcast.ip4s.{Host, Port} | ||
import org.scalatest.matchers.should.Matchers | ||
import org.scalatest.wordspec.AnyWordSpec | ||
import pureconfig.error.ConfigReaderException | ||
import pureconfig.ConfigSource | ||
|
||
class ConfigLoaderSpec extends AnyWordSpec with Matchers { | ||
|
||
"ConfigLoader" should { | ||
|
||
"load the Kafka configuration correctly" in { | ||
val kafkaConfig = ConfigLoader.kafkaConfig | ||
|
||
kafkaConfig.bootstrapServers shouldBe "localhost:9092" | ||
kafkaConfig.topic.reactions shouldBe "reactions-topic" | ||
kafkaConfig.topic.mechanisms shouldBe "mechanisms-topic" | ||
} | ||
|
||
"load the HTTP configuration correctly" in { | ||
val httpConfig = ConfigLoader.httpConfig | ||
|
||
httpConfig.host shouldBe Host.fromString("0.0.0.0").get | ||
httpConfig.port shouldBe Port.fromInt(8081).get | ||
} | ||
|
||
"load the Database configuration correctly" in { | ||
val databaseConfig = ConfigLoader.databaseConfig | ||
databaseConfig.url shouldBe "jdbc:postgresql://localhost:5432/chemist_db" | ||
databaseConfig.user shouldBe "chemist_user" | ||
databaseConfig.password shouldBe "chemist_password" | ||
} | ||
|
||
"load the entire AppConfig correctly" in { | ||
val appConfig = ConfigLoader.appConfig | ||
|
||
appConfig.kafka.bootstrapServers shouldBe "localhost:9092" | ||
appConfig.http.host shouldBe Host.fromString("0.0.0.0").get | ||
appConfig.http.port shouldBe Port.fromInt(8081).get | ||
appConfig.database.url shouldBe "jdbc:postgresql://localhost:5432/chemist_db" | ||
appConfig.database.user shouldBe "chemist_user" | ||
appConfig.database.password shouldBe "chemist_password" | ||
} | ||
|
||
"fail gracefully if required configuration is missing" in { | ||
intercept[ConfigReaderException[AppConfig]] { | ||
val invalidConfigSource = ConfigSource.string("""{ invalidKey: "invalidValue" }""") | ||
|
||
invalidConfigSource.loadOrThrow[AppConfig] | ||
} | ||
} | ||
} | ||
} |