-
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.
Merge pull request #7 from gilcu2/config
added config
- Loading branch information
Showing
10 changed files
with
107 additions
and
38 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
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 |
---|---|---|
|
@@ -2,4 +2,4 @@ | |
|
||
ID=${1:-1} | ||
|
||
curl -v http://localhost:8080/review/$ID | ||
curl -v http://localhost:8080/api/review/$ID |
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,3 +1,4 @@ | ||
#!/bin/bash | ||
|
||
curl -v -d '@data/review_sample.json' -H "Content-Type: application/json" -X POST http://localhost:8080/review | ||
curl -v -d '@data/review_sample.json' -H "Content-Type: application/json" \ | ||
-X POST http://localhost:8080/api/review |
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,12 @@ | ||
server { | ||
host = "0.0.0.0" | ||
port = 8080 | ||
} | ||
|
||
database { | ||
driver = "org.h2.Driver" | ||
url = "jdbc:h2:mem:todo;MODE=PostgreSQL;DB_CLOSE_DELAY=-1" | ||
user = "sa" | ||
password = "" | ||
thread-pool-size = 32 | ||
} |
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,16 @@ | ||
<configuration> | ||
<appender name="STDOUT" class="ch.qos.logback.core.ConsoleAppender"> | ||
<!-- On Windows machines setting withJansi to true enables ANSI | ||
color code interpretation by the Jansi library. This requires | ||
org.fusesource.jansi:jansi:1.8 on the class path. Note that | ||
Unix-based operating systems such as Linux and Mac OS X | ||
support ANSI color codes by default. --> | ||
<withJansi>true</withJansi> | ||
<encoder> | ||
<pattern>[%thread] %highlight(%-5level) %cyan(%logger{15}) - %msg %n</pattern> | ||
</encoder> | ||
</appender> | ||
<root level="INFO"> | ||
<appender-ref ref="STDOUT" /> | ||
</root> | ||
</configuration> |
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,20 @@ | ||
import cats.effect.{IO, Resource} | ||
import com.typesafe.config.ConfigFactory | ||
import pureconfig._ | ||
import pureconfig.generic.auto._ | ||
import pureconfig.module.catseffect.syntax._ | ||
|
||
|
||
package object config { | ||
case class ServerConfig(host: String ,port: Int) | ||
|
||
case class DatabaseConfig(driver: String, url: String, user: String, password: String, threadPoolSize: Int) | ||
|
||
case class Config(server: ServerConfig, database: DatabaseConfig) | ||
|
||
object Config { | ||
def load(configFile: String = "application.conf"): Resource[IO, Config] = { | ||
Resource.eval(ConfigSource.fromConfig(ConfigFactory.load(configFile)).loadF[IO, Config]()) | ||
} | ||
} | ||
} |
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,8 @@ | ||
include "application.conf" | ||
|
||
server { | ||
host = localhost | ||
port = 8081 | ||
} | ||
|
||
database.url = "jdbc:h2:mem:todo_test;MODE=PostgreSQL;DB_CLOSE_DELAY=-1" |
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