mirror of https://github.com/usbharu/Hideout.git
Merge pull request #67 from usbharu/feature/mongo-option
ジョブキューとタイムライン構築に使うDBを選択できるように
This commit is contained in:
commit
f6c25d77d3
|
@ -4,10 +4,12 @@ import dev.usbharu.hideout.domain.model.hideout.entity.Timeline
|
|||
import dev.usbharu.hideout.service.core.IdGenerateService
|
||||
import kotlinx.coroutines.Dispatchers
|
||||
import kotlinx.coroutines.withContext
|
||||
import org.springframework.boot.autoconfigure.condition.ConditionalOnProperty
|
||||
import org.springframework.stereotype.Repository
|
||||
|
||||
@Repository
|
||||
@Suppress("InjectDispatcher")
|
||||
@ConditionalOnProperty("hideout.use-mongodb", havingValue = "", matchIfMissing = false)
|
||||
class MongoTimelineRepositoryWrapper(
|
||||
private val mongoTimelineRepository: MongoTimelineRepository,
|
||||
private val idGenerateService: IdGenerateService
|
||||
|
|
|
@ -10,7 +10,7 @@ import dev.usbharu.hideout.domain.model.job.HideoutJob as HJ
|
|||
import kjob.core.dsl.JobContextWithProps as JCWP
|
||||
|
||||
@Service
|
||||
@ConditionalOnProperty(name = ["hideout.job-queue.type"], havingValue = "nosql")
|
||||
@ConditionalOnProperty(name = ["hideout.use-mongodb"], havingValue = "", matchIfMissing = false)
|
||||
class KJobMongoJobQueueWorkerService : JobQueueWorkerService {
|
||||
val kjob by lazy {
|
||||
kjob(Mongo) {
|
||||
|
|
|
@ -8,7 +8,7 @@ import org.springframework.boot.autoconfigure.condition.ConditionalOnProperty
|
|||
import org.springframework.stereotype.Service
|
||||
|
||||
@Service
|
||||
@ConditionalOnProperty(name = ["hideout.job-queue.type"], havingValue = "nosql")
|
||||
@ConditionalOnProperty(name = ["hideout.use-mongodb"], havingValue = "", matchIfMissing = false)
|
||||
class KjobMongoJobQueueParentService : JobQueueParentService {
|
||||
private val kjob = kjob(Mongo) {
|
||||
connectionString = "mongodb://localhost"
|
||||
|
|
|
@ -3,12 +3,14 @@ package dev.usbharu.hideout.service.post
|
|||
import dev.usbharu.hideout.domain.mastodon.model.generated.Status
|
||||
import dev.usbharu.hideout.domain.model.hideout.entity.Timeline
|
||||
import dev.usbharu.hideout.query.mastodon.StatusQueryService
|
||||
import org.springframework.boot.autoconfigure.condition.ConditionalOnProperty
|
||||
import org.springframework.data.mongodb.core.MongoTemplate
|
||||
import org.springframework.data.mongodb.core.query.Criteria
|
||||
import org.springframework.data.mongodb.core.query.Query
|
||||
import org.springframework.stereotype.Service
|
||||
|
||||
@Service
|
||||
@ConditionalOnProperty("hideout.use-mongodb", havingValue = "", matchIfMissing = false)
|
||||
class MongoGenerateTimelineService(
|
||||
private val statusQueryService: StatusQueryService,
|
||||
private val mongoTemplate: MongoTemplate
|
||||
|
|
|
@ -1,7 +1,6 @@
|
|||
hideout:
|
||||
url: "https://test-hideout.usbharu.dev"
|
||||
job-queue:
|
||||
type: "nosql"
|
||||
use-mongodb: true
|
||||
security:
|
||||
jwt:
|
||||
generate: true
|
||||
|
|
Loading…
Reference in New Issue