Skip to content

Commit

Permalink
#32 Disable analyzer in configuration file
Browse files Browse the repository at this point in the history
  • Loading branch information
To-om committed Sep 13, 2017
1 parent 6f1c03c commit d299267
Showing 1 changed file with 10 additions and 1 deletion.
11 changes: 10 additions & 1 deletion app/services/ExternalAnalyzerSrv.scala
Original file line number Diff line number Diff line change
Expand Up @@ -21,12 +21,14 @@ import scala.util.{ Failure, Try }
@Singleton
class ExternalAnalyzerSrv(
analyzerPath: Path,
disabledAnalyzers: Seq[String],
analyzerConfig: JsObject,
akkaSystem: ActorSystem) {

@Inject() def this(configuration: Configuration, akkaSystem: ActorSystem) =
this(
Paths.get(configuration.getString("analyzer.path").getOrElse(".")),
configuration.getStringSeq("analyzer.disabled").getOrElse(Nil),
JsonConfig.configWrites.writes(configuration.getConfig("analyzer.config").getOrElse(Configuration.empty)),
akkaSystem)

Expand All @@ -53,7 +55,14 @@ class ExternalAnalyzerSrv(
Failure(error)
}
.toOption
_ = logger.info(s"Register analyzer ${analyzer.name} ${analyzer.version} (${analyzer.id})")
.flatMap {
case a if disabledAnalyzers.contains(a.id) =>
logger.info(s"Analyzer ${a.name} ${a.version} (${a.id}) is disabled")
None
case a =>
logger.info(s"Register analyzer ${a.name} ${a.version} (${a.id})")
Some(a)
}
} yield analyzer
}

Expand Down

0 comments on commit d299267

Please sign in to comment.