startback 1.0.0 → 1.0.2
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/startback/event/bus/bunny/async.rb +4 -0
- data/lib/startback/event/bus/memory/async.rb +4 -0
- data/lib/startback/event/bus/memory/sync.rb +4 -0
- data/lib/startback/event/bus.rb +10 -0
- data/lib/startback/event/engine.rb +1 -1
- data/lib/startback/support/log_formatter.rb +7 -1
- data/lib/startback/support/redactor.rb +2 -0
- data/lib/startback/version.rb +1 -1
- data/spec/unit/support/test_redactor.rb +11 -0
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: a162a8ab216ec2a85da27179246324ec3d9a4e9f3a8b4b169b3ecb62d30c2718
|
4
|
+
data.tar.gz: '08018c87f0feb186e026bd03ee3393c546ba7172660bb6bdf9ba759c4b0b9cf9'
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 7fca430945a88c9c6eddb3ad2f1907854a3e6f6f08246a2d9358ffeb953c9eff94bf3e4b75cdaee3344e264d8509019877a3e769e3ae5cd8b00177f98ed3dee4
|
7
|
+
data.tar.gz: 7c750aa83925058090b685b44e4d14b7a2f836d98de3e10741c76c7d0ef0f6bf337654a798dbda7c2bfb2ad92eb3b3a189fdea09ea8e62eff8ecd174e7a5621b
|
data/lib/startback/event/bus.rb
CHANGED
@@ -69,6 +69,16 @@ module Startback
|
|
69
69
|
async.connect if async
|
70
70
|
end
|
71
71
|
|
72
|
+
def connected?
|
73
|
+
if sync && async
|
74
|
+
sync.connected? && async.connected?
|
75
|
+
elsif sync
|
76
|
+
sync.connected?
|
77
|
+
elsif async
|
78
|
+
async.connected?
|
79
|
+
end
|
80
|
+
end
|
81
|
+
|
72
82
|
# Emits a particular event to the listeners.
|
73
83
|
#
|
74
84
|
# @arg event an event, should be an Event instance (through duck
|
@@ -6,9 +6,10 @@ module Startback
|
|
6
6
|
pretty_print: nil
|
7
7
|
}
|
8
8
|
|
9
|
-
def initialize(options = {})
|
9
|
+
def initialize(options = {}, redactor = default_redactor)
|
10
10
|
@options = DEFAULT_OPTIONS.merge(options)
|
11
11
|
@options[:pretty_print] = auto_pretty_print unless @options.has_key?(:pretty_print)
|
12
|
+
@redactor = redactor
|
12
13
|
end
|
13
14
|
|
14
15
|
def pretty_print?
|
@@ -24,6 +25,7 @@ module Startback
|
|
24
25
|
}.merge(msg)
|
25
26
|
.merge(error: error_to_json(msg[:error], severity))
|
26
27
|
.compact
|
28
|
+
data = @redactor.redact(data)
|
27
29
|
if pretty_print?
|
28
30
|
JSON.pretty_generate(data) << "\n"
|
29
31
|
else
|
@@ -48,6 +50,10 @@ module Startback
|
|
48
50
|
|
49
51
|
private
|
50
52
|
|
53
|
+
def default_redactor
|
54
|
+
Support::Redactor.new
|
55
|
+
end
|
56
|
+
|
51
57
|
def auto_pretty_print
|
52
58
|
development?
|
53
59
|
end
|
data/lib/startback/version.rb
CHANGED
@@ -79,6 +79,17 @@ module Startback
|
|
79
79
|
})
|
80
80
|
end
|
81
81
|
|
82
|
+
it 'redacts urls as expected' do
|
83
|
+
r = Redactor.new
|
84
|
+
expect(r.redact('hello')).to eql('hello')
|
85
|
+
expect(r.redact('http://google.com')).to eql('http://google.com')
|
86
|
+
expect(r.redact('http://google.com/a/path')).to eql('http://google.com/a/path')
|
87
|
+
expect(r.redact('http://user@google.com')).to eql('http://--redacted--@google.com')
|
88
|
+
expect(r.redact('http://user@google.com/a/path')).to eql('http://--redacted--@google.com/a/path')
|
89
|
+
expect(r.redact('http://user:password@google.com')).to eql('http://--redacted--@google.com')
|
90
|
+
expect(r.redact('http://user:password@google.com/a/path')).to eql('http://--redacted--@google.com/a/path')
|
91
|
+
end
|
92
|
+
|
82
93
|
end # class Redactor
|
83
94
|
end # module Support
|
84
95
|
end # module Startback
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: startback
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.0.
|
4
|
+
version: 1.0.2
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Bernard Lambeau
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date:
|
11
|
+
date: 2024-04-24 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: rspec
|