fino 1.8.3 → 1.9.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 +4 -4
- data/README.md +29 -2
- data/lib/fino/cache.rb +2 -2
- data/lib/fino/configuration.rb +7 -3
- data/lib/fino/definition/setting.rb +4 -0
- data/lib/fino/library.rb +1 -1
- data/lib/fino/metadata.rb +1 -1
- data/lib/fino/pipe/storage.rb +6 -3
- data/lib/fino/registry.rb +2 -2
- data/lib/fino/version.rb +2 -2
- data/lib/fino.rb +5 -5
- metadata +3 -3
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA256:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: 3acbc23a5c705d61f9d9a3f9f570e262fe96b940b523aa10a9edc0dbc3738545
|
|
4
|
+
data.tar.gz: 02bba82e7d24a7939f1e54e4e17610920a18d5efa6244cdd689bc74ef1fac15b
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: 3554875390236803ebc23b16ff603bcca22a6061c8c3579b99dd678c7b74c938196e26713214707372d5dc25a6d3348c4e872960fc844a9b59810e43554113e4
|
|
7
|
+
data.tar.gz: 16287e6c8bb34a13190352eecfe8ece1b3749afcee996bedd1a8d8e797a5e9aa45fb852677fe379faf48e44eed8edb0dc007dc1d2500eb2c110976f201d16cec
|
data/README.md
CHANGED
|
@@ -1,8 +1,10 @@
|
|
|
1
1
|
# Fino
|
|
2
2
|
|
|
3
|
-
|
|
3
|
+
Fino is plug & play distributed settings engine for Ruby and Rails
|
|
4
4
|
|
|
5
|
-
|
|
5
|
+
- Blazing fast reads with multiple adapers (Redis, Active Record)
|
|
6
|
+
- Out of the box UI
|
|
7
|
+
- A/B test and override settings on the go
|
|
6
8
|
|
|
7
9
|
## Usage
|
|
8
10
|
|
|
@@ -139,6 +141,31 @@ Fino.value(:http_read_timeout, at: :my_micro_service, unit: :sec) #=> 0.2
|
|
|
139
141
|
Fino.setting(:http_read_timeout, at: :my_micro_service).value(unit: :sec) #=> 0.2
|
|
140
142
|
```
|
|
141
143
|
|
|
144
|
+
### Callbacks
|
|
145
|
+
|
|
146
|
+
Fino provides callbacks configuration that will be called once some particular action is triggered:
|
|
147
|
+
|
|
148
|
+
- `after_write` - yields `setting_definition`, `value`, `overrides` and `variants`, is triggered when setting is updated
|
|
149
|
+
|
|
150
|
+
```ruby
|
|
151
|
+
Fino.configure do
|
|
152
|
+
# ...
|
|
153
|
+
|
|
154
|
+
after_write do |setting_definition, value, overrides, variants|
|
|
155
|
+
next unless setting_definition.tags.include?(:monitor)
|
|
156
|
+
|
|
157
|
+
Monitor.track_changes("Set #{setting_definition.key} to #{value}")
|
|
158
|
+
end
|
|
159
|
+
|
|
160
|
+
settings do
|
|
161
|
+
setting :maintenance_mode, :boolean, default: false
|
|
162
|
+
|
|
163
|
+
setting :http_read_timeout, :integer, unit: :ms, default: 200, tags: %i[monitor]
|
|
164
|
+
setting :http_open_timeout, :integer, unit: :ms, default: 500, tags: %i[monitor]
|
|
165
|
+
end
|
|
166
|
+
end
|
|
167
|
+
```
|
|
168
|
+
|
|
142
169
|
## Rails integration
|
|
143
170
|
|
|
144
171
|
Fino easily integrates with Rails. Just add the gem to your Gemfile:
|
data/lib/fino/cache.rb
CHANGED
|
@@ -13,11 +13,11 @@ module Fino::Cache
|
|
|
13
13
|
raise NotImplementedError
|
|
14
14
|
end
|
|
15
15
|
|
|
16
|
-
def fetch(key, &
|
|
16
|
+
def fetch(key, &)
|
|
17
17
|
raise NotImplementedError
|
|
18
18
|
end
|
|
19
19
|
|
|
20
|
-
def fetch_multi(*keys, &
|
|
20
|
+
def fetch_multi(*keys, &)
|
|
21
21
|
raise NotImplementedError
|
|
22
22
|
end
|
|
23
23
|
|
data/lib/fino/configuration.rb
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
# frozen_string_literal: true
|
|
2
2
|
|
|
3
3
|
class Fino::Configuration
|
|
4
|
-
attr_reader :registry, :pipeline_builder_block
|
|
4
|
+
attr_reader :registry, :pipeline_builder_block, :after_write_block
|
|
5
5
|
|
|
6
6
|
def initialize(registry)
|
|
7
7
|
@registry = registry
|
|
@@ -37,7 +37,11 @@ class Fino::Configuration
|
|
|
37
37
|
@pipeline_builder_block = block
|
|
38
38
|
end
|
|
39
39
|
|
|
40
|
-
def
|
|
41
|
-
|
|
40
|
+
def after_write(&block)
|
|
41
|
+
@after_write_block = block
|
|
42
|
+
end
|
|
43
|
+
|
|
44
|
+
def settings(&)
|
|
45
|
+
Fino::Registry::DSL.new(registry).instance_eval(&)
|
|
42
46
|
end
|
|
43
47
|
end
|
|
@@ -35,6 +35,10 @@ class Fino::Definition::Setting
|
|
|
35
35
|
defined?(@description) ? @description : @description = options[:description]
|
|
36
36
|
end
|
|
37
37
|
|
|
38
|
+
def tags
|
|
39
|
+
defined?(@tags) ? @tags : @tags = options[:tags] || []
|
|
40
|
+
end
|
|
41
|
+
|
|
38
42
|
def path
|
|
39
43
|
@path ||= [setting_name, section_definition&.name].compact
|
|
40
44
|
end
|
data/lib/fino/library.rb
CHANGED
data/lib/fino/metadata.rb
CHANGED
data/lib/fino/pipe/storage.rb
CHANGED
|
@@ -3,8 +3,9 @@
|
|
|
3
3
|
class Fino::Pipe::Storage
|
|
4
4
|
include Fino::Pipe
|
|
5
5
|
|
|
6
|
-
def initialize(adapter)
|
|
6
|
+
def initialize(adapter, configuration)
|
|
7
7
|
@adapter = adapter
|
|
8
|
+
@configuration = configuration
|
|
8
9
|
end
|
|
9
10
|
|
|
10
11
|
def read(setting_definition)
|
|
@@ -18,12 +19,14 @@ class Fino::Pipe::Storage
|
|
|
18
19
|
end
|
|
19
20
|
|
|
20
21
|
def write(setting_definition, value, overrides, variants)
|
|
21
|
-
adapter.write(setting_definition, value, overrides, variants)
|
|
22
|
+
adapter.write(setting_definition, value, overrides, variants).tap do
|
|
23
|
+
configuration.after_write_block&.call(setting_definition, value, overrides, variants)
|
|
24
|
+
end
|
|
22
25
|
end
|
|
23
26
|
|
|
24
27
|
private
|
|
25
28
|
|
|
26
|
-
attr_reader :adapter
|
|
29
|
+
attr_reader :adapter, :configuration
|
|
27
30
|
|
|
28
31
|
def to_setting(setting_definition, raw_adapter_data)
|
|
29
32
|
raw_value = adapter.fetch_value_from(raw_adapter_data)
|
data/lib/fino/registry.rb
CHANGED
|
@@ -37,7 +37,7 @@ class Fino::Registry
|
|
|
37
37
|
)
|
|
38
38
|
end
|
|
39
39
|
|
|
40
|
-
def section(section_name, options = {}, &
|
|
40
|
+
def section(section_name, options = {}, &)
|
|
41
41
|
section_definition = Fino::Definition::Section.new(
|
|
42
42
|
name: section_name,
|
|
43
43
|
**options
|
|
@@ -45,7 +45,7 @@ class Fino::Registry
|
|
|
45
45
|
|
|
46
46
|
@registry.register_section(section_definition)
|
|
47
47
|
|
|
48
|
-
SectionDSL.new(section_definition, @registry).instance_eval(&
|
|
48
|
+
SectionDSL.new(section_definition, @registry).instance_eval(&)
|
|
49
49
|
end
|
|
50
50
|
end
|
|
51
51
|
|
data/lib/fino/version.rb
CHANGED
data/lib/fino.rb
CHANGED
|
@@ -5,8 +5,8 @@ require "zeitwerk"
|
|
|
5
5
|
|
|
6
6
|
module Fino
|
|
7
7
|
module Stateful
|
|
8
|
-
def configure(&
|
|
9
|
-
configuration.instance_eval(&
|
|
8
|
+
def configure(&)
|
|
9
|
+
configuration.instance_eval(&)
|
|
10
10
|
end
|
|
11
11
|
|
|
12
12
|
def reset!
|
|
@@ -15,9 +15,9 @@ module Fino
|
|
|
15
15
|
@configuration = nil
|
|
16
16
|
end
|
|
17
17
|
|
|
18
|
-
def reconfigure(&
|
|
18
|
+
def reconfigure(&)
|
|
19
19
|
reset!
|
|
20
|
-
configure(&
|
|
20
|
+
configure(&)
|
|
21
21
|
end
|
|
22
22
|
|
|
23
23
|
def library
|
|
@@ -68,7 +68,7 @@ module Fino
|
|
|
68
68
|
Logger.new($stdout).tap do |l|
|
|
69
69
|
l.progname = name
|
|
70
70
|
l.level = ENV.fetch("FINO_LOG_LEVEL", "info")
|
|
71
|
-
l.formatter = proc do |severity,
|
|
71
|
+
l.formatter = proc do |severity, _datetime, progname, msg|
|
|
72
72
|
"[#{progname}] #{severity}: #{msg}\n"
|
|
73
73
|
end
|
|
74
74
|
end
|
metadata
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
|
2
2
|
name: fino
|
|
3
3
|
version: !ruby/object:Gem::Version
|
|
4
|
-
version: 1.
|
|
4
|
+
version: 1.9.0
|
|
5
5
|
platform: ruby
|
|
6
6
|
authors:
|
|
7
7
|
- Egor Iskrenkov
|
|
@@ -83,7 +83,7 @@ required_ruby_version: !ruby/object:Gem::Requirement
|
|
|
83
83
|
requirements:
|
|
84
84
|
- - ">="
|
|
85
85
|
- !ruby/object:Gem::Version
|
|
86
|
-
version: 3.
|
|
86
|
+
version: 3.2.0
|
|
87
87
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
|
88
88
|
requirements:
|
|
89
89
|
- - ">="
|
|
@@ -92,5 +92,5 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
|
92
92
|
requirements: []
|
|
93
93
|
rubygems_version: 3.6.9
|
|
94
94
|
specification_version: 4
|
|
95
|
-
summary:
|
|
95
|
+
summary: Plug & play distributed settings engine for Ruby and Rails
|
|
96
96
|
test_files: []
|