mirror of https://github.com/usbharu/Hideout.git
feat: dbのurlなどを指定できるように
This commit is contained in:
parent
4e613c4590
commit
62eb6ddcce
|
@ -25,8 +25,7 @@ import org.jetbrains.exposed.sql.Database
|
|||
import org.koin.ktor.ext.inject
|
||||
import java.util.*
|
||||
|
||||
fun main(args: Array<String>): Unit =
|
||||
io.ktor.server.netty.EngineMain.main(args)
|
||||
fun main(args: Array<String>): Unit = io.ktor.server.netty.EngineMain.main(args)
|
||||
|
||||
@Suppress("unused") // application.conf references the main function. This annotation prevents the IDE from marking it as unused.
|
||||
fun Application.module() {
|
||||
|
@ -34,8 +33,8 @@ fun Application.module() {
|
|||
|
||||
single<Database> {
|
||||
Database.connect(
|
||||
url = "jdbc:h2:./test;MODE=POSTGRESQL",
|
||||
driver = "org.h2.Driver",
|
||||
url = environment.config.property("hideout.database.url").getString(),
|
||||
driver = environment.config.property("hideout.database.driver").getString(),
|
||||
)
|
||||
}
|
||||
single<ConfigData> {
|
||||
|
|
|
@ -4,7 +4,7 @@ import com.fasterxml.jackson.databind.ObjectMapper
|
|||
import com.fasterxml.jackson.module.kotlin.jacksonObjectMapper
|
||||
|
||||
object Config {
|
||||
var configData:ConfigData = ConfigData("", jacksonObjectMapper())
|
||||
var configData: ConfigData = ConfigData()
|
||||
}
|
||||
|
||||
data class ConfigData(val hostname:String,val objectMapper: ObjectMapper)
|
||||
data class ConfigData(val hostname: String = "", val objectMapper: ObjectMapper = jacksonObjectMapper())
|
||||
|
|
|
@ -13,4 +13,10 @@ ktor {
|
|||
hideout {
|
||||
hostname = "https://localhost:8080"
|
||||
hostname = ${?HOSTNAME}
|
||||
database {
|
||||
url = "jdbc:h2:./test;MODE=POSTGRESQL"
|
||||
driver = "org.h2.Driver"
|
||||
username = ""
|
||||
password = ""
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue