mirror of
https://github.com/ysoftdevs/odc-analyzer.git
synced 2026-01-18 01:27:45 +01:00
Added new ODC scans for Java libraries. Those can scan even transitive dependencies and can be run before adding a new library to a project.
This commit is contained in:
33
app/modules/OdcModule.scala
Normal file
33
app/modules/OdcModule.scala
Normal file
@@ -0,0 +1,33 @@
|
||||
package modules
|
||||
|
||||
import com.google.inject.{AbstractModule, Provides}
|
||||
import net.ceedubs.ficus.Ficus._
|
||||
import net.ceedubs.ficus.readers.ArbitraryTypeReader._
|
||||
import net.codingwell.scalaguice.ScalaModule
|
||||
import play.api.{Application, Configuration}
|
||||
import services.{OdcConfig, OdcDbConnectionConfig, OdcService}
|
||||
|
||||
class OdcModule extends AbstractModule with ScalaModule{
|
||||
override def configure(): Unit = {}
|
||||
|
||||
private val Drivers = Map(
|
||||
"slick.driver.MySQLDriver$" -> "org.mariadb.jdbc.Driver"
|
||||
)
|
||||
|
||||
@Provides
|
||||
def provideOdcServiceOption(conf: Configuration, application: Application): Option[OdcService] = {
|
||||
lazy val dbConfig = {
|
||||
val driverClass = Drivers(conf.getString("slick.dbs.odc.driver").get)
|
||||
val driverJar = Class.forName(driverClass).getProtectionDomain.getCodeSource.getLocation.getPath
|
||||
OdcDbConnectionConfig(
|
||||
driverClass = driverClass,
|
||||
driverJar = driverJar,
|
||||
url = conf.getString("slick.dbs.odc.db.url").get,
|
||||
user = conf.getString("slick.dbs.odc.db.user").get,
|
||||
password = conf.getString("slick.dbs.odc.db.password").get
|
||||
)
|
||||
}
|
||||
conf.underlying.getAs[OdcConfig]("odc").map(config => new OdcService(config, dbConfig)(application))
|
||||
}
|
||||
|
||||
}
|
||||
Reference in New Issue
Block a user