Skip to content

Commit

Permalink
#46 make migration streams configurable
Browse files Browse the repository at this point in the history
  • Loading branch information
To-om committed Jan 31, 2018
1 parent 27ed8c1 commit 4874dd1
Showing 1 changed file with 12 additions and 4 deletions.
16 changes: 12 additions & 4 deletions app/org/elastic4play/services/MigrationSrv.scala
Original file line number Diff line number Diff line change
Expand Up @@ -5,15 +5,17 @@ import javax.inject.{ Inject, Singleton }
import scala.concurrent.{ ExecutionContext, Future }
import scala.util.{ Failure, Success }

import play.api.Logger
import play.api.{ Configuration, Logger }
import play.api.libs.json.JsValue.jsValueToJsLookup
import play.api.libs.json.Json.toJsFieldJsValueWrapper
import play.api.libs.json._

import akka.NotUsed
import akka.stream.Materializer
import akka.actor.ActorSystem
import akka.stream.{ ActorMaterializer, ActorMaterializerSettings, Materializer }
import akka.stream.scaladsl.{ Sink, Source }
import com.sksamuel.elastic4s.ElasticDsl.search
import com.typesafe.config.Config

import org.elastic4play.InternalError
import org.elastic4play.database._
Expand Down Expand Up @@ -43,6 +45,7 @@ object DatabaseState {

@Singleton
class MigrationSrv @Inject() (
configuration: Configuration,
migration: MigrationOperations,
db: DBConfiguration,
dbcreate: DBCreate,
Expand All @@ -52,8 +55,13 @@ class MigrationSrv @Inject() (
dbindex: DBIndex,
modelSrv: ModelSrv,
eventSrv: EventSrv,
implicit val ec: ExecutionContext,
implicit val materializer: Materializer) {
implicit val system: ActorSystem,
implicit val ec: ExecutionContext) {

implicit val mat: Materializer = {
val materializerSettings = configuration.getOptional[Config]("migration.stream").map(ActorMaterializerSettings.apply)
ActorMaterializer(materializerSettings, None)
}

private[MigrationSrv] lazy val logger = Logger(getClass)

Expand Down

0 comments on commit 4874dd1

Please sign in to comment.