Skip to content

Commit

Permalink
Configure singleton Downloader
Browse files Browse the repository at this point in the history
This Downloader instance is used when a datafeed[1] URL is provided, but
will throw an NPE if it isn't configured[2].

[1]: https://github.com/rm-hull/nvd-clojure?tab=readme-ov-file#configuration-options
[2]: rm-hull#182
  • Loading branch information
tobias committed Feb 24, 2025
1 parent 02ada0f commit 2dfcac6
Showing 1 changed file with 9 additions and 7 deletions.
16 changes: 9 additions & 7 deletions src/nvd/config.clj
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@
(:import
(java.io File)
(org.owasp.dependencycheck Engine)
(org.owasp.dependencycheck.utils Settings Settings$KEYS)))
(org.owasp.dependencycheck.utils Downloader Settings Settings$KEYS)))

(def ^:private string-mappings
{Settings$KEYS/ANALYZER_NEXUS_URL [:analyzer :nexus-url]
Expand Down Expand Up @@ -209,12 +209,14 @@ You can pass an empty string for an .edn file to be automatically created."

(.setString settings Settings$KEYS/NVD_API_KEY api-key)))

(-> project
(assoc-in [:nvd :data-directory] (.getDataDirectory settings))
(assoc :engine (Engine. settings)
:title (str (app-name project) " " (:version project))
:start-time (System/currentTimeMillis)
:config-file config-filename))))
(.configure (Downloader/getInstance) settings)

(-> project
(assoc-in [:nvd :data-directory] (.getDataDirectory settings))
(assoc :engine (Engine. settings)
:title (str (app-name project) " " (:version project))
:start-time (System/currentTimeMillis)
:config-file config-filename))))

(defn cleanup [project]
(let [engine ^Engine (:engine project)
Expand Down

0 comments on commit 2dfcac6

Please sign in to comment.