hookworm-base 0.3.0 → 0.3.1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/hookworm/base/version.rb +1 -1
- data/lib/hookworm/config.rb +17 -4
- metadata +1 -1
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 359ca76440a0b1f412c8c741ad2ca069b6112442
|
4
|
+
data.tar.gz: 3eeadb39237e15d5e79eb71bcb7f8dacfdb5df0b
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 12fed51a2f7701e0f56d41ad389ec0fe8e4624c4214796c8d9f1dbb43c428de7890a22a8c6db49d5853366a1de203f1c261ef74085d1bbcb98a671b5fb172cbc
|
7
|
+
data.tar.gz: 4a596d9ec6476e3b59c707094bdf9aa56158bdfb87a5677f4b8f5611aab3658736e90dcdaa2ff26c5e89545a8e7db0cbcf86daa2510eeef0970540b7ce5ef464
|
data/lib/hookworm/config.rb
CHANGED
@@ -17,10 +17,23 @@ module Hookworm
|
|
17
17
|
end
|
18
18
|
|
19
19
|
def http_cfg
|
20
|
-
@http_cfg ||= JSON.parse(
|
21
|
-
|
22
|
-
|
23
|
-
|
20
|
+
@http_cfg ||= JSON.parse(raw_http_cfg, symbolize_names: true)
|
21
|
+
end
|
22
|
+
|
23
|
+
def raw_http_cfg
|
24
|
+
opts = {
|
25
|
+
use_ssl: http_cfg_uri.scheme == 'https',
|
26
|
+
ssl_timeout: 2.0,
|
27
|
+
open_timeout: 2.0,
|
28
|
+
read_timeout: 10.0
|
29
|
+
}
|
30
|
+
Net::HTTP.start(http_cfg_uri.host, http_cfg_uri.port, opts) do |http|
|
31
|
+
http.request(Net::HTTP::Get.new(http_cfg_uri)).body
|
32
|
+
end
|
33
|
+
end
|
34
|
+
|
35
|
+
def http_cfg_uri
|
36
|
+
@http_cfg_uri ||= URI(ENV['HOOKWORM_HTTP_CFG'])
|
24
37
|
end
|
25
38
|
|
26
39
|
def cfg_disabled?
|