gitlab-mail_room 0.0.27 → 0.1.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
  SHA256:
3
- metadata.gz: f01993f91940b070b674a54518a0f23dc638f80a467e0c8a52ebca8494d8d95d
4
- data.tar.gz: 02772517d786fb0d1d1d9b3034604954e110e5d306f2da3ceb9afb186a5509e4
3
+ metadata.gz: 92305dd07fbde3e525e8a2656a31675f00d295357c211284d5d3b64858ae97c5
4
+ data.tar.gz: c9232a9916124e91af36e56cc02c7ab26f3613bb0ba4eb4705430e250b71186e
5
5
  SHA512:
6
- metadata.gz: fc18a26e74e0c69c45a4ec5805bfb4098ed6aa85a4781d68b811a66588572cc0bb6fa87b476a3cf5250c402242393a12a8d89d19ca7ad85fab2a8c8d41bf4520
7
- data.tar.gz: 57fc5878d55e7cd0337d4a5f4b8120514a419f6651a9686e1c44bb844de3f9a55379f67f0d2391e8e2cfffd74c499e0d5fa41f334079abcabd1736a8f670b63c
6
+ metadata.gz: 0d9b23088fa1ec3fef11e128d9af5e198f59f5361cf6516c0d2112c571eb5e515c2dde66a1305158f9db4b5f0a5e5756beab10d9dadaaeb13d70a53f13453869
7
+ data.tar.gz: 9e13d1174c016aecc8dd8af1c5f75755a8c45d9e11be1bb00bdf14eb53cbffb386c167bc4dd1fb063fb3057bcfbd0a01dfe5766602af3584513ad393a558745d
data/.rubocop_todo.yml CHANGED
@@ -1,6 +1,6 @@
1
1
  # This configuration was generated by
2
2
  # `rubocop --auto-gen-config`
3
- # on 2023-03-15 01:41:21 UTC using RuboCop version 1.48.1.
3
+ # on 2026-01-14 08:16:06 UTC using RuboCop version 1.82.1.
4
4
  # The point is for the user to remove these configuration records
5
5
  # one by one as the offenses are removed from the code base.
6
6
  # Note that changes in the inspected code, or installation of new
@@ -8,20 +8,17 @@
8
8
 
9
9
  # Offense count: 5
10
10
  # This cop supports safe autocorrection (--autocorrect).
11
- # Configuration parameters: TreatCommentsAsGroupSeparators, ConsiderPunctuation, Include.
12
- # Include: **/*.gemspec
11
+ # Configuration parameters: TreatCommentsAsGroupSeparators, ConsiderPunctuation.
13
12
  Gemspec/OrderedDependencies:
14
13
  Exclude:
15
14
  - 'mail_room.gemspec'
16
15
 
17
16
  # Offense count: 1
18
- # Configuration parameters: Severity, Include.
19
- # Include: **/*.gemspec
20
17
  Gemspec/RequiredRubyVersion:
21
18
  Exclude:
22
19
  - 'mail_room.gemspec'
23
20
 
24
- # Offense count: 5
21
+ # Offense count: 1
25
22
  # This cop supports safe autocorrection (--autocorrect).
26
23
  Layout/BlockEndNewline:
27
24
  Exclude:
@@ -50,14 +47,13 @@ Layout/EmptyLinesAroundAccessModifier:
50
47
  - 'lib/mail_room/coordinator.rb'
51
48
  - 'lib/mail_room/delivery/que.rb'
52
49
 
53
- # Offense count: 4
50
+ # Offense count: 3
54
51
  # This cop supports safe autocorrection (--autocorrect).
55
52
  # Configuration parameters: EnforcedStyle.
56
53
  # SupportedStyles: empty_lines, no_empty_lines
57
54
  Layout/EmptyLinesAroundBlockBody:
58
55
  Exclude:
59
56
  - 'spec/lib/crash_handler_spec.rb'
60
- - 'spec/lib/delivery/sidekiq_spec.rb'
61
57
  - 'spec/lib/logger/structured_spec.rb'
62
58
 
63
59
  # Offense count: 1
@@ -68,7 +64,7 @@ Layout/EmptyLinesAroundClassBody:
68
64
  Exclude:
69
65
  - 'lib/mail_room/logger/structured.rb'
70
66
 
71
- # Offense count: 15
67
+ # Offense count: 7
72
68
  # This cop supports safe autocorrection (--autocorrect).
73
69
  # Configuration parameters: EnforcedStyle, IndentationWidth.
74
70
  # SupportedStyles: special_inside_parentheses, consistent, align_braces
@@ -89,13 +85,13 @@ Layout/HashAlignment:
89
85
 
90
86
  # Offense count: 2
91
87
  # This cop supports safe autocorrection (--autocorrect).
92
- # Configuration parameters: AllowDoxygenCommentStyle, AllowGemfileRubyComment.
88
+ # Configuration parameters: AllowDoxygenCommentStyle, AllowGemfileRubyComment, AllowRBSInlineAnnotation, AllowSteepAnnotation.
93
89
  Layout/LeadingCommentSpace:
94
90
  Exclude:
95
91
  - 'lib/mail_room/mailbox.rb'
96
92
  - 'spec/lib/arbitration/redis_spec.rb'
97
93
 
98
- # Offense count: 5
94
+ # Offense count: 1
99
95
  # This cop supports safe autocorrection (--autocorrect).
100
96
  Layout/MultilineBlockLayout:
101
97
  Exclude:
@@ -120,8 +116,9 @@ Layout/SpaceAroundKeyword:
120
116
 
121
117
  # Offense count: 2
122
118
  # This cop supports safe autocorrection (--autocorrect).
123
- # Configuration parameters: AllowForAlignment, EnforcedStyleForExponentOperator.
119
+ # Configuration parameters: AllowForAlignment, EnforcedStyleForExponentOperator, EnforcedStyleForRationalLiterals.
124
120
  # SupportedStylesForExponentOperator: space, no_space
121
+ # SupportedStylesForRationalLiterals: space, no_space
125
122
  Layout/SpaceAroundOperators:
126
123
  Exclude:
127
124
  - 'lib/mail_room/mailbox.rb'
@@ -138,7 +135,7 @@ Layout/SpaceBeforeBlockBraces:
138
135
  - 'spec/lib/crash_handler_spec.rb'
139
136
  - 'spec/lib/mailbox_spec.rb'
140
137
 
141
- # Offense count: 51
138
+ # Offense count: 47
142
139
  # This cop supports safe autocorrection (--autocorrect).
143
140
  # Configuration parameters: EnforcedStyle, EnforcedStyleForEmptyBraces, SpaceBeforeBlockParameters.
144
141
  # SupportedStyles: space, no_space
@@ -204,17 +201,18 @@ Lint/RescueException:
204
201
 
205
202
  # Offense count: 1
206
203
  # This cop supports safe autocorrection (--autocorrect).
207
- # Configuration parameters: AllowUnusedKeywordArguments, IgnoreEmptyMethods, IgnoreNotImplementedMethods.
204
+ # Configuration parameters: AllowUnusedKeywordArguments, IgnoreEmptyMethods, IgnoreNotImplementedMethods, NotImplementedExceptions.
205
+ # NotImplementedExceptions: NotImplementedError
208
206
  Lint/UnusedMethodArgument:
209
207
  Exclude:
210
208
  - 'lib/mail_room/logger/structured.rb'
211
209
 
212
- # Offense count: 5
210
+ # Offense count: 7
213
211
  # Configuration parameters: AllowedMethods, AllowedPatterns, CountRepeatedAttributes.
214
212
  Metrics/AbcSize:
215
- Max: 27
213
+ Max: 34
216
214
 
217
- # Offense count: 32
215
+ # Offense count: 34
218
216
  # Configuration parameters: CountComments, CountAsOne, AllowedMethods, AllowedPatterns.
219
217
  # AllowedMethods: refine
220
218
  Metrics/BlockLength:
@@ -225,12 +223,12 @@ Metrics/BlockLength:
225
223
  Metrics/ClassLength:
226
224
  Max: 169
227
225
 
228
- # Offense count: 1
226
+ # Offense count: 3
229
227
  # Configuration parameters: AllowedMethods, AllowedPatterns.
230
228
  Metrics/CyclomaticComplexity:
231
229
  Max: 8
232
230
 
233
- # Offense count: 13
231
+ # Offense count: 16
234
232
  # Configuration parameters: CountComments, CountAsOne, AllowedMethods, AllowedPatterns.
235
233
  Metrics/MethodLength:
236
234
  Max: 22
@@ -240,14 +238,13 @@ Metrics/MethodLength:
240
238
  Metrics/ModuleLength:
241
239
  Max: 172
242
240
 
243
- # Offense count: 1
244
- Naming/AccessorMethodName:
245
- Exclude:
246
- - 'lib/mail_room/configuration.rb'
241
+ # Offense count: 2
242
+ # Configuration parameters: AllowedMethods, AllowedPatterns.
243
+ Metrics/PerceivedComplexity:
244
+ Max: 9
247
245
 
248
246
  # Offense count: 1
249
- # This cop supports unsafe autocorrection (--autocorrect-all).
250
- Security/YAMLLoad:
247
+ Naming/AccessorMethodName:
251
248
  Exclude:
252
249
  - 'lib/mail_room/configuration.rb'
253
250
 
@@ -259,7 +256,7 @@ Style/Alias:
259
256
  Exclude:
260
257
  - 'lib/mail_room/coordinator.rb'
261
258
 
262
- # Offense count: 16
259
+ # Offense count: 12
263
260
  # This cop supports safe autocorrection (--autocorrect).
264
261
  # Configuration parameters: EnforcedStyle, ProceduralMethods, FunctionalMethods, AllowedMethods, AllowedPatterns, AllowBracesOnProceduralOneLiners, BracesRequiredMethods.
265
262
  # SupportedStyles: line_count_based, semantic, braces_for_chaining, always_braces
@@ -344,7 +341,7 @@ Style/GuardClause:
344
341
  # This cop supports safe autocorrection (--autocorrect).
345
342
  # Configuration parameters: EnforcedStyle, EnforcedShorthandSyntax, UseHashRocketsWithSymbolValues, PreferHashRocketsForNonAlnumEndingSymbols.
346
343
  # SupportedStyles: ruby19, hash_rockets, no_mixed_keys, ruby19_no_mixed_keys
347
- # SupportedShorthandSyntax: always, never, either, consistent
344
+ # SupportedShorthandSyntax: always, never, either, consistent, either_consistent
348
345
  Style/HashSyntax:
349
346
  Exclude:
350
347
  - 'spec/lib/microsoft_graph/connection_spec.rb'
@@ -385,7 +382,7 @@ Style/PreferredHashMethods:
385
382
  - 'lib/mail_room/mailbox.rb'
386
383
 
387
384
  # Offense count: 1
388
- # This cop supports safe autocorrection (--autocorrect).
385
+ # This cop supports unsafe autocorrection (--autocorrect-all).
389
386
  # Configuration parameters: EnforcedStyle, AllowedCompactTypes.
390
387
  # SupportedStyles: compact, exploded
391
388
  Style/RaiseArgs:
@@ -438,7 +435,7 @@ Style/StringConcatenation:
438
435
  Exclude:
439
436
  - 'lib/mail_room/logger/structured.rb'
440
437
 
441
- # Offense count: 142
438
+ # Offense count: 147
442
439
  # This cop supports safe autocorrection (--autocorrect).
443
440
  # Configuration parameters: EnforcedStyle, ConsistentQuotesInMultiline.
444
441
  # SupportedStyles: single_quotes, double_quotes
@@ -457,7 +454,7 @@ Style/SymbolArray:
457
454
  # Offense count: 2
458
455
  # This cop supports safe autocorrection (--autocorrect).
459
456
  # Configuration parameters: EnforcedStyleForMultiline.
460
- # SupportedStylesForMultiline: comma, consistent_comma, no_comma
457
+ # SupportedStylesForMultiline: comma, consistent_comma, diff_comma, no_comma
461
458
  Style/TrailingCommaInHashLiteral:
462
459
  Exclude:
463
460
  - 'spec/lib/mailbox_spec.rb'
@@ -484,9 +481,9 @@ Style/WordArray:
484
481
  EnforcedStyle: percent
485
482
  MinSize: 3
486
483
 
487
- # Offense count: 7
484
+ # Offense count: 10
488
485
  # This cop supports safe autocorrection (--autocorrect).
489
- # Configuration parameters: AllowHeredoc, AllowURI, URISchemes, IgnoreCopDirectives, AllowedPatterns.
486
+ # Configuration parameters: AllowHeredoc, AllowURI, AllowQualifiedName, URISchemes, AllowRBSInlineAnnotation, AllowCopDirectives, AllowedPatterns, SplitStrings.
490
487
  # URISchemes: http, https
491
488
  Layout/LineLength:
492
489
  Max: 177
@@ -3,9 +3,11 @@ require "redis"
3
3
  module MailRoom
4
4
  module Arbitration
5
5
  class Redis
6
- Options = Struct.new(:redis_url, :namespace, :sentinels, :sentinel_username, :sentinel_password) do
6
+ Options = Struct.new(:redis_url, :redis_ssl_params, :namespace, :redis_db, :sentinels, :sentinel_username, :sentinel_password) do
7
7
  def initialize(mailbox)
8
8
  redis_url = mailbox.arbitration_options[:redis_url] || "redis://localhost:6379"
9
+ redis_ssl_params = mailbox.arbitration_options[:redis_ssl_params]
10
+ redis_db = mailbox.arbitration_options[:redis_db] || 0
9
11
  namespace = mailbox.arbitration_options[:namespace]
10
12
  sentinels = mailbox.arbitration_options[:sentinels]
11
13
  sentinel_username = mailbox.arbitration_options[:sentinel_username]
@@ -18,7 +20,7 @@ module MailRoom
18
20
  MSG
19
21
  end
20
22
 
21
- super(redis_url, namespace, sentinels, sentinel_username, sentinel_password)
23
+ super(redis_url, redis_ssl_params, namespace, redis_db, sentinels, sentinel_username, sentinel_password)
22
24
  end
23
25
  end
24
26
 
@@ -48,7 +50,10 @@ module MailRoom
48
50
  def client
49
51
  @client ||= begin
50
52
  sentinels = options.sentinels
51
- redis_options = { url: options.redis_url }
53
+ redis_options = { url: options.redis_url, db: options.redis_db }
54
+ # Needed for redis-client 0.26.2 and older: https://github.com/redis-rb/redis-client/pull/277
55
+ redis_options[:ssl] = true if options.redis_url.start_with?("rediss://")
56
+ redis_options[:ssl_params] = options.redis_ssl_params if options.redis_ssl_params
52
57
  redis_options[:sentinels] = sentinels if sentinels
53
58
  redis_options[:sentinel_username] = options.sentinel_username if options.sentinel_username
54
59
  redis_options[:sentinel_password] = options.sentinel_password if options.sentinel_password
@@ -15,7 +15,7 @@ module MailRoom
15
15
  begin
16
16
  erb = ERB.new(File.read(options[:config_path]))
17
17
  erb.filename = options[:config_path]
18
- config_file = YAML.load(erb.result)
18
+ config_file = YAML.load(erb.result, symbolize_names: true)
19
19
 
20
20
  set_mailboxes(config_file[:mailboxes])
21
21
  set_health_check(config_file[:health_check])
@@ -8,9 +8,10 @@ module MailRoom
8
8
  # Sidekiq Delivery method
9
9
  # @author Douwe Maan
10
10
  class Sidekiq
11
- Options = Struct.new(:redis_url, :namespace, :sentinels, :queue, :worker, :logger, :redis_db, :sentinel_username, :sentinel_password) do
11
+ Options = Struct.new(:redis_url, :redis_ssl_params, :namespace, :sentinels, :queue, :worker, :logger, :redis_db, :sentinel_username, :sentinel_password) do
12
12
  def initialize(mailbox)
13
13
  redis_url = mailbox.delivery_options[:redis_url] || "redis://localhost:6379"
14
+ redis_ssl_params = mailbox.delivery_options[:redis_ssl_params]
14
15
  redis_db = mailbox.delivery_options[:redis_db] || 0
15
16
  namespace = mailbox.delivery_options[:namespace]
16
17
  sentinels = mailbox.delivery_options[:sentinels]
@@ -27,7 +28,7 @@ module MailRoom
27
28
  MSG
28
29
  end
29
30
 
30
- super(redis_url, namespace, sentinels, queue, worker, logger, redis_db, sentinel_username, sentinel_password)
31
+ super(redis_url, redis_ssl_params, namespace, sentinels, queue, worker, logger, redis_db, sentinel_username, sentinel_password)
31
32
  end
32
33
  end
33
34
 
@@ -56,6 +57,9 @@ module MailRoom
56
57
  @client ||= begin
57
58
  sentinels = options.sentinels
58
59
  redis_options = { url: options.redis_url, db: options.redis_db }
60
+ # Needed for redis-client 0.26.2 and older: https://github.com/redis-rb/redis-client/pull/277
61
+ redis_options[:ssl] = true if options.redis_url.start_with?("rediss://")
62
+ redis_options[:ssl_params] = options.redis_ssl_params if options.redis_ssl_params
59
63
  redis_options[:sentinels] = sentinels if sentinels
60
64
  redis_options[:sentinel_username] = options.sentinel_username if options.sentinel_username
61
65
  redis_options[:sentinel_password] = options.sentinel_password if options.sentinel_password
@@ -1,4 +1,4 @@
1
1
  module MailRoom
2
2
  # Current version of gitlab-mail_room gem
3
- VERSION = "0.0.27"
3
+ VERSION = "0.1.0"
4
4
  end
@@ -169,5 +169,28 @@ describe MailRoom::Arbitration::Redis do
169
169
  end
170
170
  end
171
171
  end
172
+
173
+ context 'when redis_ssl_params is specified' do
174
+ let(:redis_url) { ENV['REDIS_URL'] }
175
+ let(:redis_ssl_params) { { verify_mode: OpenSSL::SSL::VERIFY_NONE } }
176
+ let(:mailbox) {
177
+ build_mailbox(
178
+ arbitration_options: {
179
+ redis_url: redis_url,
180
+ redis_ssl_params: redis_ssl_params
181
+ }
182
+ )
183
+ }
184
+
185
+ after do
186
+ redis.del("delivered:123")
187
+ end
188
+
189
+ it 'client has same specified ssl_params' do
190
+ subject.deliver?(123)
191
+
192
+ expect(raw_client.config.ssl_params).to eq(redis_ssl_params)
193
+ end
194
+ end
172
195
  end
173
196
  end
@@ -120,5 +120,23 @@ describe MailRoom::Delivery::Sidekiq do
120
120
  end
121
121
  end
122
122
  end
123
+
124
+ context 'when redis_ssl_params is specified' do
125
+ let(:redis_url) { ENV['REDIS_URL'] }
126
+ let(:redis_ssl_params) { { verify_mode: OpenSSL::SSL::VERIFY_NONE } }
127
+ let(:mailbox) {
128
+ build_mailbox(
129
+ delivery_method: :sidekiq,
130
+ delivery_options: {
131
+ redis_url: redis_url,
132
+ redis_ssl_params: redis_ssl_params
133
+ }
134
+ )
135
+ }
136
+
137
+ it 'client has same specified ssl_params' do
138
+ expect(raw_client.config.ssl_params).to eq(redis_ssl_params)
139
+ end
140
+ end
123
141
  end
124
142
  end
metadata CHANGED
@@ -1,13 +1,13 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: gitlab-mail_room
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.27
4
+ version: 0.1.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Tony Pitale
8
8
  bindir: bin
9
9
  cert_chain: []
10
- date: 2025-03-06 00:00:00.000000000 Z
10
+ date: 2026-01-16 00:00:00.000000000 Z
11
11
  dependencies:
12
12
  - !ruby/object:Gem::Dependency
13
13
  name: net-imap