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 org.koin.ktor.ext.inject
|
||||||
import java.util.*
|
import java.util.*
|
||||||
|
|
||||||
fun main(args: Array<String>): Unit =
|
fun main(args: Array<String>): Unit = io.ktor.server.netty.EngineMain.main(args)
|
||||||
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.
|
@Suppress("unused") // application.conf references the main function. This annotation prevents the IDE from marking it as unused.
|
||||||
fun Application.module() {
|
fun Application.module() {
|
||||||
|
@ -34,8 +33,8 @@ fun Application.module() {
|
||||||
|
|
||||||
single<Database> {
|
single<Database> {
|
||||||
Database.connect(
|
Database.connect(
|
||||||
url = "jdbc:h2:./test;MODE=POSTGRESQL",
|
url = environment.config.property("hideout.database.url").getString(),
|
||||||
driver = "org.h2.Driver",
|
driver = environment.config.property("hideout.database.driver").getString(),
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
single<ConfigData> {
|
single<ConfigData> {
|
||||||
|
|
|
@ -4,7 +4,7 @@ import com.fasterxml.jackson.databind.ObjectMapper
|
||||||
import com.fasterxml.jackson.module.kotlin.jacksonObjectMapper
|
import com.fasterxml.jackson.module.kotlin.jacksonObjectMapper
|
||||||
|
|
||||||
object Config {
|
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 {
|
hideout {
|
||||||
hostname = "https://localhost:8080"
|
hostname = "https://localhost:8080"
|
||||||
hostname = ${?HOSTNAME}
|
hostname = ${?HOSTNAME}
|
||||||
|
database {
|
||||||
|
url = "jdbc:h2:./test;MODE=POSTGRESQL"
|
||||||
|
driver = "org.h2.Driver"
|
||||||
|
username = ""
|
||||||
|
password = ""
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue