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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: a6359847344d330c339ce4f6e78e1862c5f9ef25c0f38fc72d9ee1e217c623fe
4
- data.tar.gz: d7e47d63dc31f421fe725e5eb08ce6bcd45be9ab4cb618217f69a6d543e0e3ef
3
+ metadata.gz: 4d7af7e3821827b5ba9a59a1202e4bb9c96315f825c2af4cf14961c0a1eadc6d
4
+ data.tar.gz: 27781a193736cb8032d4f6cf21657d6603fbccca177d617723bf1f48670bcabe
5
5
  SHA512:
6
- metadata.gz: 860902f3d043a84218b42033ac4d0cf342ae06485fbea61844b69758e849c38d88247d9e34323c39647f34dfe973d881843c2415056b22b445910b034dc3f7ed
7
- data.tar.gz: 81cc1d0207ac8cfd63e3ea2ed70d8a23e103152288620d136304bc32e0049411bfee940b6a2dedb268756e3585c300661ea063ae2fa8aa02e4203c0d5615c353
6
+ metadata.gz: 1338f901f1d7e0d5c2a74e7adede0b36a485361aaa1f80650b5cc55dfc47de410df4f1e1a40c95673b8d814f2add472b7c93e156ffa0cee15d76a7e30c9ef939
7
+ data.tar.gz: 170bd8fb884b03d97ff76f36305fdee78b3791b0005136ddf183d9239745b67e9c39e147c52b35f255223a3f01b6e664d55033731d6a942ee361904e0eb75e59
@@ -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
@@ -1,3 +1,3 @@
1
1
  module DeadBroHub
2
- VERSION = "0.1.1"
2
+ VERSION = "0.1.2"
3
3
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: dead_bro_hub
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.1
4
+ version: 0.1.2
5
5
  platform: ruby
6
6
  authors:
7
7
  - Ruby Dev SRL