feature_toggle_service 0.1.0 → 0.2.0
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
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 97173447d2c7730c6eb7652a661d8a4bcf91e000
|
4
|
+
data.tar.gz: 99dd4e73c690b9430a80de32c636bb30a8849566
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: cd2fa824df094f88bf07f2538b90de72d6dfb9ef0268a614fff96c5cbb3897ee4f54e945bc1dac6af36870232d64d3961b5cea355fc14eea4d1e7b2b2ec66bfe
|
7
|
+
data.tar.gz: 56d9eb5477bdb0ae15771e68c2f18ff3c1c0966693a30f99fd0a87e3e0afb8e1d5d4556b2a2f17a0f494f44047fe378aab1a1e59c9b1b45003cb2a340b348edb
|
data/README.md
CHANGED
@@ -9,6 +9,8 @@ A client for Feature Toggles. It uses [hobknob](https://github.com/opentable/hob
|
|
9
9
|
|
10
10
|
It also supports overrides and defaults.
|
11
11
|
|
12
|
+
note: if Airbrake is defined and etcd is not reachable, it `Airbrake.notify(exception)` will be called, where `exception` is the `Errno::ECONNREFUSED` error.
|
13
|
+
|
12
14
|
## Basic use
|
13
15
|
|
14
16
|
We use `on?` and `off?` methods, to check if a feature is enabled or disabled in hobknob. We use a simple String or Symbol as the key. It performs a `to_s` to the key so using `:feature` or `'feature'` is the same.
|
@@ -42,6 +44,7 @@ A default is set to ON with `FeatureToggleService.default_on(key)`, and to OFF w
|
|
42
44
|
|
43
45
|
We can remove a default with `FeatureToggleService.unset_default(key)`, or all of hem with `FeatureToggleService.clear_default`.
|
44
46
|
|
47
|
+
The default value will be returned if the key is not found in hobknob, or if etcd does not respond.
|
45
48
|
|
46
49
|
## Config parameters
|
47
50
|
|
@@ -59,7 +59,7 @@ module FeatureToggleService
|
|
59
59
|
default_value_for(key)
|
60
60
|
rescue Errno::ECONNREFUSED => e
|
61
61
|
logger.error { "Cannot connect with Feature Toggle Repository! #{key.inspect}, final key #{fk.inspect}." }
|
62
|
-
Airbrake.notify(e)
|
62
|
+
Airbrake.notify(e) if defined?(Airbrake)
|
63
63
|
default_value_for(key)
|
64
64
|
end
|
65
65
|
|
@@ -25,6 +25,9 @@ module FeatureToggleService
|
|
25
25
|
# FOR TESTS, DEFAULTS and OVERRIDES
|
26
26
|
delegate :unset_override, :clear_overrides, :unset_default, :clear_defaults, to: :repository
|
27
27
|
|
28
|
+
# check if ETCD is enabled or not
|
29
|
+
delegate :enabled?, to: :config
|
30
|
+
|
28
31
|
# helper methods
|
29
32
|
def default_on(key)
|
30
33
|
repository.set_default key, true
|