ft_gem 3.2.3 → 3.2.7

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
- SHA256:
3
- metadata.gz: b333c05567a5be9cc6d934ba301abc34c0b20d71423b4c9bd74b2b4785b0f5ba
4
- data.tar.gz: 67b80f508437e2ffaa342eefac5685091d684dc98662e2340fc98bdb80f61c24
2
+ SHA1:
3
+ metadata.gz: 212273bf41a194c45f3c3c8021ebe712be110027
4
+ data.tar.gz: cfab39aeccf578f1df5beec51255a03a2c448fdd
5
5
  SHA512:
6
- metadata.gz: 7938240f6c14e58801e9ab5f5d2075db179e7655395a1592b700e45596ebac80c886df56279009e852918ea1a01ebcffe5471c0312cbafd8582092e3d60b5f26
7
- data.tar.gz: 764fbf30382d7ca98d72c0427ea2c4f5f60fdcd2ef9b6dfa977c1e8cfeb56a44af208151cc239388e3973c878eac2b587bdd9e010da47ab7ee30e9f7a2f58c71
6
+ metadata.gz: 42faaf44b67c17c0d1d354231a42daaa52495d9e77bd996917ea44b80b5fedaee4d448a10cfb2a0503449044f4dcbe369213a337fd1b3ce3de64676a9c42e925
7
+ data.tar.gz: 9031f6721ff0d0070ef50bd6edb9985a2ac2dbaec654802e35cb46d403bd698661a4be9715cb4ec0e0a9ce77560deef5fc54e28ae4d6162f232aed4cfb92aa1e
@@ -1,8 +1,15 @@
1
1
  class FtShared
2
+
3
+ def svc_url
4
+ url = ENV['MICROSVC_URL']
5
+ url = ENV['SITE_URL'] unless url
6
+ url
7
+ end
8
+
2
9
  def fetch(name:)
3
10
  http_response = ''
4
11
  Rails.cache.fetch("feature-toggle-#{name}", expires_in: 1.minute) do
5
- http_response = HTTParty.get("#{ENV['SITE_URL']}/service/ft/api/v1/feature-toggles/status", query: { name: name }, headers: authentication_header)
12
+ http_response = HTTParty.get("#{svc_url}/service/ft/api/v1/feature-toggles/status", query: { name: name }, headers: header_hash)
6
13
  JSON.parse(http_response.to_json)['data']
7
14
  end
8
15
  rescue StandardError => e
@@ -12,15 +19,15 @@ class FtShared
12
19
 
13
20
  def all_toggles
14
21
  Rails.cache.fetch('all-feature-toggles', expires_in: 1.minute) do
15
- JSON.parse(HTTParty.get("#{ENV['SITE_URL']}/service/ft/api/v1/feature-toggles", headers: authentication_header).to_json)['data']
22
+ JSON.parse(HTTParty.get("#{svc_url}/service/ft/api/v1/feature-toggles", headers: header_hash).to_json)['data']
16
23
  end
17
24
  rescue StandardError => e
18
25
  Rails.logger.error "FtHelper::all_toggles error #{e.message}"
19
26
  {}
20
27
  end
21
28
 
22
- def authentication_header
23
- { Authorization: "Bearer #{MumsnetJWT.tokenify}" }
29
+ def header_hash
30
+ { Authorization: "Bearer #{MumsnetJWT.tokenify}", Host: "#{ENV['SITE_HOSTNAME']}" }
24
31
  end
25
32
 
26
33
  def whitelisted?(url:, whitelist_urls:)
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: ft_gem
3
3
  version: !ruby/object:Gem::Version
4
- version: 3.2.3
4
+ version: 3.2.7
5
5
  platform: ruby
6
6
  authors:
7
7
  - Murray Catto
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2020-11-19 00:00:00.000000000 Z
11
+ date: 2021-05-21 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: mumsnet_jwt
@@ -67,7 +67,8 @@ required_rubygems_version: !ruby/object:Gem::Requirement
67
67
  - !ruby/object:Gem::Version
68
68
  version: '0'
69
69
  requirements: []
70
- rubygems_version: 3.0.3
70
+ rubyforge_project:
71
+ rubygems_version: 2.5.2.3
71
72
  signing_key:
72
73
  specification_version: 4
73
74
  summary: Client side feature toggle