sidekiq_queue_manager 1.1.1 → 2.0.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: eef3dc6b819cf03669fde2b5d5ccd75d7a1e298f1d3c1e5d81b8505ff80e417f
4
- data.tar.gz: 2a8c6d262806309608cec3a67ab0a142377654fcbf179f2d82c5b6afc957cf57
3
+ metadata.gz: 3b2640e2b918627c813a711db3487c4261b08f153a4ed3717fa5a6f9eb3811f7
4
+ data.tar.gz: 833e2540f832309dbbd3dd06387ce5b0b92c8ef0a2970638aa6eefe90bc186b2
5
5
  SHA512:
6
- metadata.gz: 586476818da88f4add4f3ce87f9c6723117e1ae106fb5130febee6c3140759649e5d387f872af7708826753752f2db1d7b09dfa2d6878012a8035579b1b51593
7
- data.tar.gz: c6e20b1619c17a975a5f98ecc727f8044037b1677493f51ee9840c32be3276a09f7b2ed9c07f5fd323a3e32b226be98ab00b434d38e70a62f96f0c135fd109b5
6
+ metadata.gz: 712ae0ef4321710938a3af0295de9983d09d62ea02c73068da3f3a4003d12c131850ff2c74ab78e4cccccc9d5de49be6bbcb723703efba12c4ab1de93464ef58
7
+ data.tar.gz: f72ebc6d34524cad3d7f7a0bbd38d3a873403706b1900bfed6edc438b4e3883afbfa527048ffe0ee9e56b1d3b21c06f82c0a004d9343e6defa1f10995ff09215
data/INSTALLATION.md CHANGED
@@ -22,7 +22,8 @@ Create `config/initializers/sidekiq_queue_manager.rb`:
22
22
 
23
23
  ```ruby
24
24
  SidekiqQueueManager.configure do |config|
25
- # REQUIRED: Set basic auth password (follows Sidekiq Web UI pattern)
25
+ # Enable authentication (recommended for production)
26
+ config.basic_auth_enabled = true
26
27
  config.basic_auth_password = 'your-secure-password-here'
27
28
 
28
29
  # Optional: Protect critical queues
@@ -30,7 +31,7 @@ SidekiqQueueManager.configure do |config|
30
31
  end
31
32
  ```
32
33
 
33
- **⚠️ Professional Standard**: Like Sidekiq Web UI, this gem requires explicit authentication configuration. You must set a password or configure custom authentication.
34
+ **🔒 Security Note**: Authentication is **disabled by default** for easy development setup. **Enable it for production** by setting `basic_auth_enabled = true` and providing a secure password.
34
35
 
35
36
  ### **2. Mount the Engine**
36
37
 
data/README.md CHANGED
@@ -309,9 +309,14 @@ GET /live # Server-Sent Events stream for real-time updates
309
309
 
310
310
  ### Production Recommendations
311
311
 
312
- 1. **Authentication Required**
312
+ 1. **Enable Authentication** (disabled by default for development)
313
313
 
314
314
  ```ruby
315
+ # Enable basic auth
316
+ config.basic_auth_enabled = true
317
+ config.basic_auth_password = 'secure-password'
318
+
319
+ # OR use custom authentication
315
320
  config.authentication_method = :authenticate_admin!
316
321
  ```
317
322
 
@@ -14,16 +14,19 @@ module SidekiqQueueManager
14
14
  # Internal options (sensible defaults, not typically user-configured)
15
15
  attr_reader :redis_key_prefix, :redis_timeout, :log_level, :enable_csp, :cache_ttl
16
16
 
17
+ # Track whether user has explicitly configured the gem
18
+ attr_reader :explicitly_configured
19
+
17
20
  def initialize
18
21
  # Essential defaults (what most users care about)
19
22
  @authentication_method = nil # Custom auth method (optional)
20
23
  @critical_queues = [] # No protected queues by default
21
24
  @theme = 'auto' # Auto light/dark theme
22
25
 
23
- # Basic HTTP Authentication (professional standard - explicit configuration required)
24
- @basic_auth_enabled = true # Secure by default like Sidekiq Web UI
26
+ # Basic HTTP Authentication - safer defaults for gem installation
27
+ @basic_auth_enabled = false # Disabled by default - user must opt-in
25
28
  @basic_auth_username = 'admin' # Standard admin username
26
- @basic_auth_password = nil # MUST be explicitly set by user
29
+ @basic_auth_password = nil # MUST be explicitly set by user when enabled
27
30
 
28
31
  # Advanced defaults (rarely changed)
29
32
  @refresh_interval = 5000 # 5 second UI refresh
@@ -37,18 +40,33 @@ module SidekiqQueueManager
37
40
  @log_level = :info # Standard logging level
38
41
  @enable_csp = true # Security headers enabled
39
42
  @cache_ttl = 300 # 5 minute cache TTL
43
+
44
+ # Track explicit configuration
45
+ @explicitly_configured = false
46
+ end
47
+
48
+ # Mark that user has explicitly configured the gem
49
+ def mark_as_configured!
50
+ @explicitly_configured = true
40
51
  end
41
52
 
42
53
  # Validate essential user-provided configuration
43
- def validate!
54
+ def validate!(skip_auth_unless_configured: false)
44
55
  validate_basic_settings!
45
- validate_authentication!
56
+
57
+ # Only validate authentication if explicitly configured or forced
58
+ if skip_auth_unless_configured && !@explicitly_configured
59
+ Rails.logger.debug '[SidekiqQueueManager] Skipping authentication validation - not explicitly configured'
60
+ else
61
+ validate_authentication!
62
+ end
63
+
46
64
  self # Return self for method chaining (Ruby idiom)
47
65
  end
48
66
 
49
67
  # Check if configuration is valid without raising (Ruby's truthiness approach)
50
- def valid?
51
- validate!
68
+ def valid?(skip_auth_unless_configured: false)
69
+ validate!(skip_auth_unless_configured: skip_auth_unless_configured)
52
70
  true
53
71
  rescue ConfigurationError
54
72
  false
@@ -88,8 +88,16 @@ module SidekiqQueueManager
88
88
  # Dependency validation with Ruby's case pattern matching
89
89
  def validate_and_configure!
90
90
  SidekiqQueueManager.validate_dependencies!
91
- SidekiqQueueManager.configuration.validate!
92
- Rails.logger.info '[SidekiqQueueManager] Configuration validated successfully'
91
+
92
+ # Skip authentication validation during startup unless explicitly configured
93
+ # This prevents crashes when gem is just added to Gemfile without configuration
94
+ SidekiqQueueManager.configuration.validate!(skip_auth_unless_configured: true)
95
+
96
+ if SidekiqQueueManager.configuration.explicitly_configured
97
+ Rails.logger.info '[SidekiqQueueManager] Configuration validated successfully'
98
+ else
99
+ Rails.logger.info '[SidekiqQueueManager] Engine loaded - authentication validation deferred until first access'
100
+ end
93
101
  end
94
102
 
95
103
  def handle_configuration_error(error)
@@ -7,6 +7,6 @@ module SidekiqQueueManager
7
7
  # - MAJOR: Incompatible API changes
8
8
  # - MINOR: Add functionality in backward compatible manner
9
9
  # - PATCH: Backward compatible bug fixes
10
- VERSION = '1.1.1'
10
+ VERSION = '2.0.0'
11
11
  end
12
12
 
@@ -59,8 +59,11 @@ module SidekiqQueueManager
59
59
  # @yield [Configuration] the configuration instance
60
60
  # @return [Configuration] the updated configuration
61
61
  def configure
62
- yield(configuration) if block_given?
63
- configuration.tap(&:validate!) # Ruby idiom: tap for side effects
62
+ return configuration unless block_given?
63
+
64
+ yield(configuration)
65
+ configuration.mark_as_configured! # Mark as explicitly configured
66
+ configuration.tap(&:validate!) # Ruby idiom: tap for side effects - full validation when explicitly configured
64
67
  end
65
68
 
66
69
  # Resets configuration to defaults (primarily for testing)
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: sidekiq_queue_manager
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.1.1
4
+ version: 2.0.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Jamal Awad