File tree Expand file tree Collapse file tree 3 files changed +11
-10
lines changed
plugins/scanners/scanoss/src Expand file tree Collapse file tree 3 files changed +11
-10
lines changed Original file line number Diff line number Diff line change @@ -60,7 +60,7 @@ class ScanOss internal constructor(
6060 ScanOss (type, config, matcherConfig)
6161
6262 override fun parseConfig (options : Options , secrets : Options ) =
63- ScanOssConfig .create(options).also { logger.info { " The $type API URL is ${it.apiUrl} ." } }
63+ ScanOssConfig .create(options, secrets ).also { logger.info { " The $type API URL is ${it.apiUrl} ." } }
6464 }
6565
6666 private val service = ScanOssService .create(config.apiUrl)
Original file line number Diff line number Diff line change @@ -25,8 +25,11 @@ import org.ossreviewtoolkit.utils.common.Options
2525
2626/* *
2727 * A data class that holds the configuration options supported by the [ScanOss] scanner. An instance of this class is
28- * created from the options contained in a [ScannerConfiguration] object under the key _ScanOss_. It offers the
28+ * created from the [scanner config] [ScannerConfiguration.config ] object under the key _ScanOss_. It offers the
2929 * following configuration options:
30+ *
31+ * **"options.apiUrl":** The URL of the ScanOSS server.
32+ * **"secrets.apiKey":** The API key to authenticate with the ScanOSS server.
3033 */
3134data class ScanOssConfig (
3235 /* * URL of the ScanOSS server. */
@@ -42,9 +45,9 @@ data class ScanOssConfig(
4245 /* * Name of the configuration property for the API key. */
4346 const val API_KEY_PROPERTY = " apiKey"
4447
45- fun create (options : Options ): ScanOssConfig {
48+ fun create (options : Options , secrets : Options ): ScanOssConfig {
4649 val apiUrl = options[API_URL_PROPERTY ] ? : ScanOssService .DEFAULT_API_URL
47- val apiKey = options [API_KEY_PROPERTY ].orEmpty()
50+ val apiKey = secrets [API_KEY_PROPERTY ].orEmpty()
4851
4952 return ScanOssConfig (apiUrl, apiKey)
5053 }
Original file line number Diff line number Diff line change @@ -28,19 +28,17 @@ import org.ossreviewtoolkit.clients.scanoss.ScanOssService
2828
2929class ScanOssConfigTest : StringSpec ({
3030 " Default values are used" {
31- with(ScanOssConfig .create(emptyMap())) {
31+ with(ScanOssConfig .create(emptyMap(), emptyMap() )) {
3232 apiUrl shouldBe ScanOssService .DEFAULT_API_URL
3333 apiKey should beEmpty()
3434 }
3535 }
3636
3737 " Default values can be overridden" {
38- val options = mapOf(
39- ScanOssConfig .API_URL_PROPERTY to "url",
40- ScanOssConfig .API_KEY_PROPERTY to "key"
41- )
38+ val options = mapOf(ScanOssConfig .API_URL_PROPERTY to "url")
39+ val secrets = mapOf(ScanOssConfig .API_KEY_PROPERTY to "key")
4240
43- with(ScanOssConfig .create(options)) {
41+ with(ScanOssConfig .create(options, secrets )) {
4442 apiUrl shouldBe " url"
4543 apiKey shouldBe " key"
4644 }
You can’t perform that action at this time.
0 commit comments