File tree Expand file tree Collapse file tree 3 files changed +12
-3
lines changed Expand file tree Collapse file tree 3 files changed +12
-3
lines changed Original file line number Diff line number Diff line change 11# Changelog
22
33## Unreleased
4-
4+ * [ # 215 ] ( https://github.com/clojure-emacs/refactor-nrepl/issues/215 ) Support JVM system proxy in mvn artifacts listing
55* [ #198 ] ( https://github.com/clojure-emacs/refactor-nrepl/issues/187 ) Delay middleware loading to speed up initialization.
66* Bump [ mranderson] ( https://github.com/benedekfazekas/mranderson ) version to fix leiningen 2.8.x incompatibility issues
77
Original file line number Diff line number Diff line change @@ -96,6 +96,7 @@ Any configuration settings passed along with the message will replace the defaul
9696### Artifact lookup
9797
9898This middleware provides operations for obtaining information about artifacts from clojars, or mvn central.
99+ If JVM system proxy properties are defined (e.g. http.proxyHost, http.proxyPort) they will be used for downloading the artifacts.
99100
100101Two ops are available:
101102
Original file line number Diff line number Diff line change 1717(defonce artifacts (atom {} :meta {:last-modified nil }))
1818(def millis-per-day (* 24 60 60 1000 ))
1919
20+ (defn- get-proxy-opts
21+ " Generates proxy options from JVM properties for httpkit-client "
22+ []
23+ (when-let [proxy-host (some #(System/getProperty %) [" https.proxyHost" " http.proxyHost" ])]
24+ {:proxy-host proxy-host
25+ :proxy-port (some->> [" https.proxyPort" " http.proxyPort" ]
26+ (some #(System/getProperty %)) Integer/parseInt)}))
27+
2028(defn get-artifacts-from-clojars!
2129 " Returns a vector of [[some/lib \" 0.1\" ]...]."
2230 []
4755 (let [search-prefix " http://search.maven.org/solrsearch/select?q=g:%22"
4856 search-suffix " %22+AND+p:%22jar%22&rows=2000&wt=json"
4957 search-url (str search-prefix group-id search-suffix)
50- {:keys [_ _ body _]} @(http/get search-url { :as :text } )
58+ {:keys [_ _ body _]} @(http/get search-url ( assoc ( get-proxy-opts ) :as :text ) )
5159 search-result (json/parse-string body true )]
5260 (map :a (-> search-result :response :docs ))))
5361
6068 " %22+AND+a:%22"
6169 artifact
6270 " %22&core=gav&rows=200&wt=json" )
63- { :as :text } )]
71+ ( assoc ( get-proxy-opts ) :as :text ) )]
6472 (->> (json/parse-string body true )
6573 :response
6674 :docs
You can’t perform that action at this time.
0 commit comments