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 +5 -5
- data/lib/ft_gem/shared/ft_shared.rb +11 -4
- metadata +4 -3
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
|
-
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
2
|
+
SHA1:
|
3
|
+
metadata.gz: 212273bf41a194c45f3c3c8021ebe712be110027
|
4
|
+
data.tar.gz: cfab39aeccf578f1df5beec51255a03a2c448fdd
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
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("#{
|
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("#{
|
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
|
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.
|
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:
|
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
|
-
|
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
|