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 1
1
# Changelog
2
2
3
3
## Unreleased
4
-
4
+ * [ # 215 ] ( https://github.com/clojure-emacs/refactor-nrepl/issues/215 ) Support JVM system proxy in mvn artifacts listing
5
5
* [ #198 ] ( https://github.com/clojure-emacs/refactor-nrepl/issues/187 ) Delay middleware loading to speed up initialization.
6
6
* Bump [ mranderson] ( https://github.com/benedekfazekas/mranderson ) version to fix leiningen 2.8.x incompatibility issues
7
7
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
96
96
### Artifact lookup
97
97
98
98
This 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.
99
100
100
101
Two ops are available:
101
102
Original file line number Diff line number Diff line change 17
17
(defonce artifacts (atom {} :meta {:last-modified nil }))
18
18
(def millis-per-day (* 24 60 60 1000 ))
19
19
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
+
20
28
(defn get-artifacts-from-clojars!
21
29
" Returns a vector of [[some/lib \" 0.1\" ]...]."
22
30
[]
47
55
(let [search-prefix " http://search.maven.org/solrsearch/select?q=g:%22"
48
56
search-suffix " %22+AND+p:%22jar%22&rows=2000&wt=json"
49
57
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 ) )
51
59
search-result (json/parse-string body true )]
52
60
(map :a (-> search-result :response :docs ))))
53
61
60
68
" %22+AND+a:%22"
61
69
artifact
62
70
" %22&core=gav&rows=200&wt=json" )
63
- { :as :text } )]
71
+ ( assoc ( get-proxy-opts ) :as :text ) )]
64
72
(->> (json/parse-string body true )
65
73
:response
66
74
:docs
You can’t perform that action at this time.
0 commit comments