From 9a93099f60048380be0e46c13911a1bbd21dbd65 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=C5=A0est=C3=A1k=20V=C3=ADt?= Date: Tue, 1 Aug 2017 16:04:19 +0200 Subject: [PATCH] Added config option for NuGet -source --- app/services/OdcService.scala | 7 ++++--- conf/application.conf.-example | 9 +++++---- 2 files changed, 9 insertions(+), 7 deletions(-) diff --git a/app/services/OdcService.scala b/app/services/OdcService.scala index e7fc8fe..ea2411f 100644 --- a/app/services/OdcService.scala +++ b/app/services/OdcService.scala @@ -21,7 +21,7 @@ import scala.concurrent.{ExecutionContext, Future} case class OdcDbConnectionConfig(driverClass: String, driverJar: String, url: String, user: String, password: String) -case class OdcConfig(odcPath: String, extraArgs: Seq[String] = Seq(), workingDirectory: String = ".", propertyFile: Option[String], cleanTmpDir: Boolean = true) +case class OdcConfig(odcPath: String, extraArgs: Seq[String] = Seq(), workingDirectory: String = ".", propertyFile: Option[String], cleanTmpDir: Boolean = true, dotNetNugetSource: Option[String]) case class SingleLibraryScanResult(mainDependencies: Seq[GroupedDependency], transitiveDependencies: Seq[GroupedDependency], includesTransitive: Boolean, limitationsOption: Option[String]) @@ -95,13 +95,14 @@ class OdcService @Inject() (odcConfig: OdcConfig, odcDbConnectionConfig: OdcDbCo val packagesConfigFile = dir.resolve("..").resolve("packages.config") Files.write(packagesConfigFile, packagesConfig.toString().getBytes(UTF_8)) import sys.process._ - Seq( + val cmd = Seq( nugetBin, "restore", packagesConfigFile.toString, "-PackagesDirectory", dir.toString - ).!! + ) ++ odcConfig.dotNetNugetSource.fold(Seq[String]())(source => Seq("-source", source)) + cmd.!! } private def consumeStream(in: InputStream): Array[Byte] = { diff --git a/conf/application.conf.-example b/conf/application.conf.-example index 8d2e038..8ba9dbe 100644 --- a/conf/application.conf.-example +++ b/conf/application.conf.-example @@ -149,10 +149,11 @@ slick.dbs.odc { ## (i) You will also need to configure contexts.odc-workers for this functionality. # odc { # odcPath = "/path/to/dependency-check-X.Y.Z-release" -# workingDirectory = "/path/to/odc/config" # directory ODC works in; you can use relative paths from this directory -# propertyFile = "odc.props" # path to ODC property file -# extraArgs = [] # Unstable conf; This might be changed or removed without any notice!!! -# cleanTmpDir = true # Leave temporary directory for debugging +# workingDirectory = "/path/to/odc/config" # [optional] directory ODC works in; you can use relative paths from this directory +# propertyFile = "odc.props" # [optional] path to ODC property file +# dotNetNugetSource = "https://path/to/your/nuget/proxy" # [optional] +# extraArgs = [] # [optional] Unstable conf; This might be changed or removed without any notice!!! +# cleanTmpDir = true # [optional] Keep temporary directory content for debugging # } silhouette {