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 +4 -4
- data/INSTALLATION.md +3 -2
- data/README.md +6 -1
- data/lib/sidekiq_queue_manager/configuration.rb +25 -7
- data/lib/sidekiq_queue_manager/engine.rb +10 -2
- data/lib/sidekiq_queue_manager/version.rb +1 -1
- data/lib/sidekiq_queue_manager.rb +5 -2
- metadata +1 -1
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 3b2640e2b918627c813a711db3487c4261b08f153a4ed3717fa5a6f9eb3811f7
|
4
|
+
data.tar.gz: 833e2540f832309dbbd3dd06387ce5b0b92c8ef0a2970638aa6eefe90bc186b2
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
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
|
-
#
|
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
|
-
|
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
|
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
|
24
|
-
@basic_auth_enabled =
|
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
|
-
|
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
|
-
|
92
|
-
|
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)
|
@@ -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
|
-
|
63
|
-
|
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)
|