solid_queue_monitor 2.0.0 → 2.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:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: 92ff7e193202f9653de1b877d2e5d8b2f841c1e50e6c86a9ba4c556782e1fe8b
|
|
4
|
+
data.tar.gz: 2d180ede70f06618f676d167674238e4e7940e02f0b5af56b2667f543ab833f0
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: 203a85cfcb427b2d21faf15c0203bea8c06ee8a01296ad94d318aae018ad83cd8a7c86b9ac633a300588df9a7dc012a1ba42c2a0bcc91e1b97829816e527bba2
|
|
7
|
+
data.tar.gz: 4a3904c1f727a72d47d960cfc0e20c70ffd0f0f5c62463c652d31123653956e73874661d67b15a7cdbd14b6d36aed322b946548f2906d73860f6ef12d79c4ce2
|
data/README.md
CHANGED
|
@@ -124,6 +124,10 @@ SolidQueueMonitor.setup do |config|
|
|
|
124
124
|
# Disable the chart on the overview page to skip chart queries entirely
|
|
125
125
|
# config.show_chart = true
|
|
126
126
|
end
|
|
127
|
+
|
|
128
|
+
# Optional: inherit from a host-app controller to plug into your existing auth.
|
|
129
|
+
# See "Custom Authentication" below. Defaults to "ActionController::Base".
|
|
130
|
+
# SolidQueueMonitor.base_controller_class = 'AdminController'
|
|
127
131
|
```
|
|
128
132
|
|
|
129
133
|
### Performance at Scale
|
|
@@ -159,6 +163,48 @@ config.username = -> { Rails.application.credentials.dig(:solid_queue_monitor, :
|
|
|
159
163
|
config.password = -> { Rails.application.credentials.dig(:solid_queue_monitor, :password) }
|
|
160
164
|
```
|
|
161
165
|
|
|
166
|
+
### Custom Authentication
|
|
167
|
+
|
|
168
|
+
By default, Solid Queue Monitor uses HTTP Basic auth with the username/password from `SolidQueueMonitor.setup`. To integrate with your app's existing auth (Devise, Pundit, OmniAuth, custom sessions, etc.), point the engine at a base controller from your host app:
|
|
169
|
+
|
|
170
|
+
```ruby
|
|
171
|
+
# config/initializers/solid_queue_monitor.rb
|
|
172
|
+
SolidQueueMonitor.setup do |config|
|
|
173
|
+
config.authentication_enabled = false # disable HTTP Basic
|
|
174
|
+
end
|
|
175
|
+
|
|
176
|
+
# Inherit from your own controller so its before_actions, rescue_froms,
|
|
177
|
+
# layout, and current_user helper cascade into the engine.
|
|
178
|
+
SolidQueueMonitor.base_controller_class = 'AdminController'
|
|
179
|
+
```
|
|
180
|
+
|
|
181
|
+
**Minimal example — just authenticate:**
|
|
182
|
+
|
|
183
|
+
```ruby
|
|
184
|
+
class AdminController < ApplicationController
|
|
185
|
+
before_action :authenticate_user! # Devise (or your equivalent)
|
|
186
|
+
end
|
|
187
|
+
```
|
|
188
|
+
|
|
189
|
+
**Richer example — require an admin role:**
|
|
190
|
+
|
|
191
|
+
```ruby
|
|
192
|
+
class AdminController < ApplicationController
|
|
193
|
+
before_action :authenticate_user!
|
|
194
|
+
before_action :require_admin
|
|
195
|
+
|
|
196
|
+
private
|
|
197
|
+
|
|
198
|
+
def require_admin
|
|
199
|
+
redirect_to root_path, alert: 'Not authorized' unless current_user&.admin?
|
|
200
|
+
end
|
|
201
|
+
end
|
|
202
|
+
```
|
|
203
|
+
|
|
204
|
+
Leave `authentication_enabled = true` if you want HTTP Basic to run *on top of* your host auth (host runs first, HTTP Basic second). Most adopters disable it.
|
|
205
|
+
|
|
206
|
+
Restart your server after changing this config — the class hierarchy is set at load time, so config changes won't take effect on a live process.
|
|
207
|
+
|
|
162
208
|
## Usage
|
|
163
209
|
|
|
164
210
|
After installation, visit `/solid_queue` in your browser to access the dashboard.
|
|
@@ -1,10 +1,16 @@
|
|
|
1
1
|
# frozen_string_literal: true
|
|
2
2
|
|
|
3
3
|
module SolidQueueMonitor
|
|
4
|
-
class ApplicationController < ActionController::Base
|
|
4
|
+
class ApplicationController < SolidQueueMonitor.base_controller_class.safe_constantize || ActionController::Base
|
|
5
5
|
include ActionController::HttpAuthentication::Basic::ControllerMethods
|
|
6
6
|
include ActionController::Flash
|
|
7
7
|
|
|
8
|
+
# Explicitly include the engine's helpers so they remain available when the
|
|
9
|
+
# host configures a custom base_controller_class. Rails auto-includes engine
|
|
10
|
+
# helpers only when the parent is ActionController::Base; inheriting from a
|
|
11
|
+
# host controller short-circuits that, breaking view methods like render_chart.
|
|
12
|
+
helper SolidQueueMonitor::Engine.helpers
|
|
13
|
+
|
|
8
14
|
before_action :authenticate, if: -> { SolidQueueMonitor::AuthenticationService.authentication_required? }
|
|
9
15
|
layout 'solid_queue_monitor/application'
|
|
10
16
|
skip_before_action :verify_authenticity_token
|
data/lib/solid_queue_monitor.rb
CHANGED
|
@@ -5,8 +5,11 @@ require_relative 'solid_queue_monitor/engine'
|
|
|
5
5
|
|
|
6
6
|
module SolidQueueMonitor
|
|
7
7
|
class Error < StandardError; end
|
|
8
|
+
|
|
9
|
+
DEFAULT_BASE_CONTROLLER_CLASS = 'ActionController::Base'
|
|
10
|
+
|
|
8
11
|
class << self
|
|
9
|
-
attr_writer :username, :password
|
|
12
|
+
attr_writer :username, :password, :base_controller_class
|
|
10
13
|
attr_accessor :jobs_per_page, :authentication_enabled,
|
|
11
14
|
:auto_refresh_enabled, :auto_refresh_interval, :show_chart
|
|
12
15
|
|
|
@@ -18,6 +21,10 @@ module SolidQueueMonitor
|
|
|
18
21
|
resolve_value(@password)
|
|
19
22
|
end
|
|
20
23
|
|
|
24
|
+
def base_controller_class
|
|
25
|
+
@base_controller_class || DEFAULT_BASE_CONTROLLER_CLASS
|
|
26
|
+
end
|
|
27
|
+
|
|
21
28
|
private
|
|
22
29
|
|
|
23
30
|
def resolve_value(value)
|