fix: 設定ファイルが読み込まれていなかったのを修正

This commit is contained in:
usbharu 2023-04-08 16:19:58 +09:00
parent e77c28c6c2
commit 527750b3a6
2 changed files with 15 additions and 3 deletions

View File

@ -1,5 +1,10 @@
package dev.usbharu.hideout package dev.usbharu.hideout
import com.fasterxml.jackson.annotation.JsonInclude
import com.fasterxml.jackson.databind.DeserializationFeature
import com.fasterxml.jackson.module.kotlin.jacksonObjectMapper
import dev.usbharu.hideout.config.Config
import dev.usbharu.hideout.config.ConfigData
import dev.usbharu.hideout.plugins.* import dev.usbharu.hideout.plugins.*
import dev.usbharu.hideout.repository.IUserAuthRepository import dev.usbharu.hideout.repository.IUserAuthRepository
import dev.usbharu.hideout.repository.IUserRepository import dev.usbharu.hideout.repository.IUserRepository
@ -28,6 +33,13 @@ val Application.property: Application.(propertyName: String) -> String
@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() {
Config.configData = ConfigData(
url = property("hideout.url"),
objectMapper = jacksonObjectMapper().enable(DeserializationFeature.ACCEPT_SINGLE_VALUE_AS_ARRAY)
.setSerializationInclusion(JsonInclude.Include.NON_EMPTY)
.configure(DeserializationFeature.FAIL_ON_UNKNOWN_PROPERTIES, false)
)
val module = org.koin.dsl.module { val module = org.koin.dsl.module {
single<Database> { single<Database> {
Database.connect( Database.connect(
@ -44,7 +56,7 @@ fun Application.module() {
single<HttpSignatureVerifyService> { HttpSignatureVerifyServiceImpl(get()) } single<HttpSignatureVerifyService> { HttpSignatureVerifyServiceImpl(get()) }
single<ActivityPubService> { ActivityPubServiceImpl() } single<ActivityPubService> { ActivityPubServiceImpl() }
single<UserService> { UserService(get()) } single<UserService> { UserService(get()) }
single<ActivityPubUserService> { ActivityPubUserServiceImpl(get(),get()) } single<ActivityPubUserService> { ActivityPubUserServiceImpl(get(), get()) }
} }
configureKoin(module) configureKoin(module)

View File

@ -11,8 +11,8 @@ ktor {
} }
hideout { hideout {
hostname = "https://localhost:8080" url = "http://localhost:8080"
hostname = ${?HOSTNAME}
database { database {
url = "jdbc:h2:./test;MODE=POSTGRESQL" url = "jdbc:h2:./test;MODE=POSTGRESQL"
driver = "org.h2.Driver" driver = "org.h2.Driver"