Skip to content

Commit

Permalink
feat(dos): Allow to configure scan storage settings
Browse files Browse the repository at this point in the history
Do not hard-code esp. `writeToStorage` to `false` as in the ORT server
use-case, where no ORT results files are used, scan results need to be
stored in order to pass them to other tools. Instead, take scan storage
settings from the `ScannerWrapperConfig`, like for the `FossId` scanner.

Signed-off-by: Sebastian Schuberth <sebastian@doubleopen.org>
  • Loading branch information
sschuberth committed Jul 2, 2024
1 parent b67dda9 commit 4bb80bb
Showing 1 changed file with 8 additions and 6 deletions.
14 changes: 8 additions & 6 deletions plugins/scanners/dos/src/main/kotlin/DosScanner.kt
Original file line number Diff line number Diff line change
Expand Up @@ -68,22 +68,24 @@ import org.ossreviewtoolkit.utils.ort.createOrtTempDir
class DosScanner internal constructor(
override val name: String,
private val config: DosScannerConfig,
override val readFromStorage: Boolean,
override val writeToStorage: Boolean
wrapperConfig: ScannerWrapperConfig
) : PackageScannerWrapper {
class Factory : ScannerWrapperFactory<DosScannerConfig>("DOS") {
override fun create(config: DosScannerConfig, wrapperConfig: ScannerWrapperConfig) =
DosScanner(type, config, readFromStorage = false, writeToStorage = false)
DosScanner(type, config, wrapperConfig)

override fun parseConfig(options: Options, secrets: Options) = DosScannerConfig.create(options, secrets)
}

override val matcher: ScannerMatcher? = null
override val configuration = ""

// TODO: Introduce a DOS version and expose it through the API to use it here.
override val version = "1.0.0"

override val configuration = ""

override val matcher: ScannerMatcher? = null
override val readFromStorage by lazy { wrapperConfig.readFromStorageWithDefault(matcher) }
override val writeToStorage by lazy { wrapperConfig.writeToStorageWithDefault(matcher) }

private val service = DosService.create(config.url, config.token, config.timeout?.let { Duration.ofSeconds(it) })
internal val client = DosClient(service)

Expand Down

0 comments on commit 4bb80bb

Please sign in to comment.