Skip to content

Commit

Permalink
#71 Add proxy settings under "config.proxy" in analyzer input
Browse files Browse the repository at this point in the history
  • Loading branch information
To-om committed Apr 3, 2018
1 parent c8cc720 commit 6a98b6b
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 4 deletions.
5 changes: 4 additions & 1 deletion app/org/thp/cortex/models/Job.scala
Original file line number Diff line number Diff line change
Expand Up @@ -45,5 +45,8 @@ class JobModel @Inject() () extends ModelDef[JobModel, Job]("job", "Job", "/job"
class Job(model: JobModel, attributes: JsObject) extends EntityDef[JobModel, Job](model, attributes) with JobAttributes {
val params: JsObject = Try(Json.parse(parameters()).as[JsObject]).getOrElse(JsObject.empty)

override def toJson: JsObject = super.toJson + ("date" -> Json.toJson(createdAt))
override def toJson: JsObject = {
val output = super.toJson + ("date" -> Json.toJson(createdAt))
input().fold(output)(i output + ("input" -> Json.parse(i)))
}
}
6 changes: 3 additions & 3 deletions app/org/thp/cortex/services/JobSrv.scala
Original file line number Diff line number Diff line change
Expand Up @@ -415,9 +415,9 @@ class JobSrv(
.validatedBy(_.read(configAndParam))
.map(cfg Json.obj("config" -> JsObject(cfg).deepMerge(analyzerDefinition.configuration)))
.map { cfg
val proxy_http = (cfg \ "proxy_http").asOpt[String].fold(JsObject.empty) { proxy Json.obj("proxy" -> Json.obj("http" -> proxy)) }
val proxy_https = (cfg \ "proxy_https").asOpt[String].fold(JsObject.empty) { proxy Json.obj("proxy" -> Json.obj("https" -> proxy)) }
cfg.deepMerge(proxy_http).deepMerge(proxy_https)
val proxy_http = (cfg \ "config" \ "proxy_http").asOpt[String].fold(JsObject.empty) { proxy Json.obj("proxy" -> Json.obj("http" -> proxy)) }
val proxy_https = (cfg \ "config" \ "proxy_https").asOpt[String].fold(JsObject.empty) { proxy Json.obj("proxy" -> Json.obj("https" -> proxy)) }
cfg.deepMerge(Json.obj("config" -> (proxy_http.deepMerge(proxy_https))))
}
.map(_ deepMerge artifact +
("dataType" -> JsString(job.dataType())) +
Expand Down

0 comments on commit 6a98b6b

Please sign in to comment.