ree_lib 1.3.6 → 1.3.8
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/.rubocop.yml +1 -1
- data/Gemfile +1 -0
- data/Gemfile.lock +10 -3
- data/lib/ree_lib/packages/ree_http/package/ree_http/functions/build_request_executor.rb +6 -1
- data/lib/ree_lib/packages/ree_roda/package/ree_roda/plugins/ree_logger.rb +20 -3
- data/lib/ree_lib/packages/ree_roda/spec/ree_roda/plugins/ree_logger_spec.rb +36 -0
- data/lib/ree_lib/version.rb +1 -1
- metadata +2 -1
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA256:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: 91fc8dfb82375a041a8174ecb6845cc67b808ff127789f7a0cfc7acf77dd070d
|
|
4
|
+
data.tar.gz: 9559a1c0ab2a12444b80321ffeee129104eb50e3ab18b1245190747eec34e168
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: 043c917b9aedca9ead3eda2ebf43e1ad5404abf818b6a8aa63fc2827b677ad850785c4ebdb46b135e1f9967bb1cc66b04524b0124d6ea5218cabee98b348e90e
|
|
7
|
+
data.tar.gz: ca3d90247859cb1dde09162aa2e3479f6e9cacc038ea8b083bda2fa9704015314cce9b39154d639b0c60f9caf1f0268dd3c89bfc383e999f556b66193225ed64
|
data/.rubocop.yml
CHANGED
data/Gemfile
CHANGED
data/Gemfile.lock
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
PATH
|
|
2
2
|
remote: ../ree
|
|
3
3
|
specs:
|
|
4
|
-
ree (1.3.
|
|
4
|
+
ree (1.3.2)
|
|
5
5
|
base64
|
|
6
6
|
commander
|
|
7
7
|
logger
|
|
@@ -9,7 +9,7 @@ PATH
|
|
|
9
9
|
PATH
|
|
10
10
|
remote: .
|
|
11
11
|
specs:
|
|
12
|
-
ree_lib (1.3.
|
|
12
|
+
ree_lib (1.3.8)
|
|
13
13
|
bigdecimal
|
|
14
14
|
binding_of_caller
|
|
15
15
|
i18n
|
|
@@ -25,6 +25,7 @@ GEM
|
|
|
25
25
|
addressable (2.8.8)
|
|
26
26
|
public_suffix (>= 2.0.2, < 8.0)
|
|
27
27
|
base64 (0.3.0)
|
|
28
|
+
benchmark (0.5.0)
|
|
28
29
|
bigdecimal (4.0.1)
|
|
29
30
|
binding_of_caller (2.0.0)
|
|
30
31
|
debug_inspector (>= 1.2.0)
|
|
@@ -50,11 +51,14 @@ GEM
|
|
|
50
51
|
crass (~> 1.0.2)
|
|
51
52
|
nokogiri (>= 1.12.0)
|
|
52
53
|
msgpack (1.8.0)
|
|
54
|
+
nokogiri (1.19.1-arm64-darwin)
|
|
55
|
+
racc (~> 1.4)
|
|
53
56
|
nokogiri (1.19.1-x86_64-darwin)
|
|
54
57
|
racc (~> 1.4)
|
|
55
58
|
nokogiri (1.19.1-x86_64-linux-gnu)
|
|
56
59
|
racc (~> 1.4)
|
|
57
60
|
ostruct (0.6.3)
|
|
61
|
+
pg (1.6.3-arm64-darwin)
|
|
58
62
|
pg (1.6.3-x86_64-darwin)
|
|
59
63
|
pg (1.6.3-x86_64-linux)
|
|
60
64
|
public_suffix (7.0.2)
|
|
@@ -85,6 +89,7 @@ GEM
|
|
|
85
89
|
ostruct
|
|
86
90
|
sequel (5.101.0)
|
|
87
91
|
bigdecimal
|
|
92
|
+
sqlite3 (2.9.0-arm64-darwin)
|
|
88
93
|
sqlite3 (2.9.0-x86_64-darwin)
|
|
89
94
|
sqlite3 (2.9.0-x86_64-linux-gnu)
|
|
90
95
|
timecop (0.9.10)
|
|
@@ -98,6 +103,7 @@ GEM
|
|
|
98
103
|
hashdiff (>= 0.4.0, < 2.0.0)
|
|
99
104
|
|
|
100
105
|
PLATFORMS
|
|
106
|
+
arm64-darwin-24
|
|
101
107
|
x86_64-darwin-19
|
|
102
108
|
x86_64-darwin-21
|
|
103
109
|
x86_64-darwin-22
|
|
@@ -105,6 +111,7 @@ PLATFORMS
|
|
|
105
111
|
x86_64-linux
|
|
106
112
|
|
|
107
113
|
DEPENDENCIES
|
|
114
|
+
benchmark
|
|
108
115
|
bootsnap
|
|
109
116
|
faker
|
|
110
117
|
pg
|
|
@@ -121,4 +128,4 @@ DEPENDENCIES
|
|
|
121
128
|
webmock
|
|
122
129
|
|
|
123
130
|
BUNDLED WITH
|
|
124
|
-
|
|
131
|
+
4.0.6
|
|
@@ -39,8 +39,13 @@ class ReeHttp::BuildRequestExecutor
|
|
|
39
39
|
opts = DEFAULTS.merge(opts)
|
|
40
40
|
proxy = opts[:proxy] || {}
|
|
41
41
|
|
|
42
|
+
if proxy.empty? && (env_proxy = ENV['https_proxy'] || ENV['http_proxy'])
|
|
43
|
+
proxy_uri = URI(env_proxy)
|
|
44
|
+
proxy = { address: proxy_uri.host, port: proxy_uri.port }
|
|
45
|
+
end
|
|
46
|
+
|
|
42
47
|
request_executor = Net::HTTP.new(
|
|
43
|
-
uri.hostname, uri.port
|
|
48
|
+
uri.hostname, uri.port,
|
|
44
49
|
proxy[:address], proxy[:port], proxy[:username], proxy[:password]
|
|
45
50
|
)
|
|
46
51
|
|
|
@@ -11,14 +11,18 @@ class Roda
|
|
|
11
11
|
module ReeLogger
|
|
12
12
|
REE_LOGGER_DEFAULTS = {
|
|
13
13
|
method: :info,
|
|
14
|
-
log_params: true
|
|
14
|
+
log_params: true,
|
|
15
|
+
filter_params: [],
|
|
16
|
+
filter_params_placeholder: '[FILTERED]'
|
|
15
17
|
}
|
|
16
18
|
|
|
17
19
|
def self.configure(app, **opts)
|
|
18
20
|
opts = REE_LOGGER_DEFAULTS.merge(opts)
|
|
19
|
-
app.opts[:ree_logger] = ::ReeLogger::Logger.new
|
|
21
|
+
app.opts[:ree_logger] = opts[:ree_logger] || ::ReeLogger::Logger.new
|
|
20
22
|
app.opts[:ree_logger_filter] = opts[:filter] if opts[:filter]
|
|
21
23
|
app.opts[:ree_logger_log_params] = !!opts[:log_params]
|
|
24
|
+
app.opts[:ree_logger_filter_params] = opts[:filter_params].map(&:to_s)
|
|
25
|
+
app.opts[:ree_logger_filter_params_placeholder] = opts[:filter_params_placeholder]
|
|
22
26
|
end
|
|
23
27
|
|
|
24
28
|
def self.start_timer
|
|
@@ -46,7 +50,7 @@ class Roda
|
|
|
46
50
|
|
|
47
51
|
message = <<~DOC
|
|
48
52
|
Request/Response details:
|
|
49
|
-
Request: #{env["REQUEST_METHOD"]} #{env["QUERY_STRING"] && !env["QUERY_STRING"].empty? ? env["SCRIPT_NAME"].to_s + env["PATH_INFO"] + "?#{env["QUERY_STRING"]}": env["SCRIPT_NAME"].to_s + env["PATH_INFO"]} #{opts[:ree_logger_log_params] ? "\n Params: " +
|
|
53
|
+
Request: #{env["REQUEST_METHOD"]} #{env["QUERY_STRING"] && !env["QUERY_STRING"].empty? ? env["SCRIPT_NAME"].to_s + env["PATH_INFO"] + "?#{env["QUERY_STRING"]}": env["SCRIPT_NAME"].to_s + env["PATH_INFO"]} #{opts[:ree_logger_log_params] ? "\n Params: " + _ree_logger_filtered_params.inspect : ""}
|
|
50
54
|
Response status: #{response.status || "-"}#{(400..499).include?(response.status) ? "\n Response body: " + response.body[0].to_s : ""}
|
|
51
55
|
Time Taken: #{elapsed_time}
|
|
52
56
|
DOC
|
|
@@ -54,6 +58,19 @@ class Roda
|
|
|
54
58
|
opts[:ree_logger].info(message)
|
|
55
59
|
end
|
|
56
60
|
|
|
61
|
+
def _ree_logger_filtered_params
|
|
62
|
+
params = request.params
|
|
63
|
+
filter_keys = opts[:ree_logger_filter_params]
|
|
64
|
+
|
|
65
|
+
return params if filter_keys.empty?
|
|
66
|
+
|
|
67
|
+
placeholder = opts[:ree_logger_filter_params_placeholder]
|
|
68
|
+
|
|
69
|
+
params.each_with_object({}) do |(k, v), h|
|
|
70
|
+
h[k] = filter_keys.include?(k.to_s) ? placeholder : v
|
|
71
|
+
end
|
|
72
|
+
end
|
|
73
|
+
|
|
57
74
|
# Create timer instance used for timing
|
|
58
75
|
def _roda_before_05__ree_logger
|
|
59
76
|
@_request_timer = ReeLogger.start_timer
|
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
# frozen_string_literal = true
|
|
2
|
+
|
|
3
|
+
package_require("ree_roda/plugins/ree_logger")
|
|
4
|
+
|
|
5
|
+
RSpec.describe :ree_logger do
|
|
6
|
+
it "filters request params" do
|
|
7
|
+
class TestFilterApp < ReeRoda::App
|
|
8
|
+
route do |r|
|
|
9
|
+
r.get "health" do
|
|
10
|
+
"success"
|
|
11
|
+
end
|
|
12
|
+
|
|
13
|
+
r.ree_routes
|
|
14
|
+
end
|
|
15
|
+
end
|
|
16
|
+
|
|
17
|
+
env = { "REQUEST_METHOD" => "GET", "PATH_INFO" => "/health", "QUERY_STRING" => "email=test@example.com&password=password" }
|
|
18
|
+
|
|
19
|
+
class TestFilterLogger
|
|
20
|
+
def info(msg)
|
|
21
|
+
@logs ||= []
|
|
22
|
+
@logs << msg
|
|
23
|
+
end
|
|
24
|
+
|
|
25
|
+
def logs
|
|
26
|
+
@logs
|
|
27
|
+
end
|
|
28
|
+
end
|
|
29
|
+
logger = TestFilterLogger.new
|
|
30
|
+
|
|
31
|
+
TestFilterApp.plugin(:ree_logger, ree_logger: logger, filter_params: ['password'])
|
|
32
|
+
TestFilterApp.app.call(env)
|
|
33
|
+
|
|
34
|
+
expect(logger.logs.first).to match('"password" => "\[FILTERED\]"')
|
|
35
|
+
end
|
|
36
|
+
end
|
data/lib/ree_lib/version.rb
CHANGED
metadata
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
|
2
2
|
name: ree_lib
|
|
3
3
|
version: !ruby/object:Gem::Version
|
|
4
|
-
version: 1.3.
|
|
4
|
+
version: 1.3.8
|
|
5
5
|
platform: ruby
|
|
6
6
|
authors:
|
|
7
7
|
- Ruslan Gatiyatov
|
|
@@ -891,6 +891,7 @@ files:
|
|
|
891
891
|
- lib/ree_lib/packages/ree_roda/package/ree_roda/services/build_swagger_from_routes.rb
|
|
892
892
|
- lib/ree_lib/packages/ree_roda/package/ree_roda/services/status_from_error.rb
|
|
893
893
|
- lib/ree_lib/packages/ree_roda/spec/ree_roda/app_spec.rb
|
|
894
|
+
- lib/ree_lib/packages/ree_roda/spec/ree_roda/plugins/ree_logger_spec.rb
|
|
894
895
|
- lib/ree_lib/packages/ree_roda/spec/ree_roda/services/build_routing_tree_spec.rb
|
|
895
896
|
- lib/ree_lib/packages/ree_roda/spec/ree_roda/services/build_swagger_from_routes_spec.rb
|
|
896
897
|
- lib/ree_lib/packages/ree_roda/spec/ree_roda/services/locales/en.yml
|