call the evaluator with the API token

This commit is contained in:
Thibault Duplessis 2014-07-03 21:39:23 +02:00
parent 131555cb57
commit 31b7c1b2e4
2 changed files with 6 additions and 3 deletions

View file

@ -12,13 +12,15 @@ final class Env(
private val CollectionEvaluation = config getString "collection.evaluation"
private val EvaluatorScriptPath = config getString "evaluator.script_path"
private val ActorName = config getString "actor.name"
private val ApiToken = config getString "api.token"
lazy val evaluator = new Evaluator(
coll = db(CollectionEvaluation),
script = EvaluatorScriptPath,
reporter = hub.actor.report,
analyser = hub.actor.analyser,
marker = hub.actor.mod)
marker = hub.actor.mod,
token = ApiToken)
system.actorOf(Props(new Listener(evaluator)), name = ActorName)
}

View file

@ -21,7 +21,8 @@ final class Evaluator(
script: String,
reporter: ActorSelection,
analyser: ActorSelection,
marker: ActorSelection) {
marker: ActorSelection,
token: String) {
import Evaluation._
@ -105,7 +106,7 @@ final class Evaluator(
}
private def run(userId: String, deep: Boolean): Try[String] = {
val command = s"""$script $userId ${deep ?? "true"}"""
val command = s"""$script $userId ${deep.fold("true", "false")} $token""".pp
Try {
import scala.sys.process._
command!!