dead_bro_hub 0.1.1 → 0.1.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/lib/dead_bro_hub/api.rb +8 -1
- data/lib/dead_bro_hub/version.rb +1 -1
- metadata +1 -1
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA256:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: 4d7af7e3821827b5ba9a59a1202e4bb9c96315f825c2af4cf14961c0a1eadc6d
|
|
4
|
+
data.tar.gz: 27781a193736cb8032d4f6cf21657d6603fbccca177d617723bf1f48670bcabe
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: 1338f901f1d7e0d5c2a74e7adede0b36a485361aaa1f80650b5cc55dfc47de410df4f1e1a40c95673b8d814f2add472b7c93e156ffa0cee15d76a7e30c9ef939
|
|
7
|
+
data.tar.gz: 170bd8fb884b03d97ff76f36305fdee78b3791b0005136ddf183d9239745b67e9c39e147c52b35f255223a3f01b6e664d55033731d6a942ee361904e0eb75e59
|
data/lib/dead_bro_hub/api.rb
CHANGED
|
@@ -43,9 +43,14 @@ module DeadBroHub
|
|
|
43
43
|
Rails.cache.fetch(cache_key(path, params), expires_in: config.cache_ttl) { request(path, params) }
|
|
44
44
|
end
|
|
45
45
|
|
|
46
|
+
def environment
|
|
47
|
+
DeadBro.env.to_s
|
|
48
|
+
end
|
|
49
|
+
|
|
46
50
|
# The key is hashed in: it must not end up in a cache store or its logs.
|
|
51
|
+
# The environment is part of it: staging and production share a key but not data.
|
|
47
52
|
def cache_key(path, params)
|
|
48
|
-
[ "dead_bro_hub", Digest::SHA256.hexdigest(config.api_key)[0, 16], path, params.sort.to_h.to_query ].join("/")
|
|
53
|
+
[ "dead_bro_hub", Digest::SHA256.hexdigest(config.api_key)[0, 16], environment, path, params.sort.to_h.to_query ].join("/")
|
|
49
54
|
end
|
|
50
55
|
|
|
51
56
|
def request(path, params)
|
|
@@ -60,6 +65,8 @@ module DeadBroHub
|
|
|
60
65
|
req = Net::HTTP::Get.new(uri)
|
|
61
66
|
req["Authorization"] = "Bearer #{config.api_key}"
|
|
62
67
|
req["Accept"] = "application/json"
|
|
68
|
+
# One API key serves every environment of an app, so say which one this process is.
|
|
69
|
+
req["X-DeadBro-Env"] = environment
|
|
63
70
|
|
|
64
71
|
parse(http.request(req))
|
|
65
72
|
rescue Timeout::Error, SocketError, SystemCallError, EOFError, OpenSSL::SSL::SSLError => error
|
data/lib/dead_bro_hub/version.rb
CHANGED