solid_queue_monitor 1.2.0 → 1.2.1
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: 6de5c6ef734c44e24c72e13d194fa9e6243fa5cefce591f430daa6f6dc1f175d
|
|
4
|
+
data.tar.gz: 7065afd18960ef8f61b7131fa96fd7c46120b75c52c2b633a34f63b686b8ca2c
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: 6e899fddd4e1b08cf84beeff8b93f8ca67c199ce98d795983335300bf15fc087fe8ab0009d2a75746ae4d90b68f0b609f03c7ca44fb50ac0784551fc1e111a6b
|
|
7
|
+
data.tar.gz: eecbd91a4eee221f13431810542e92c3fa06403d2279a00e447e186c00a4d34479c134461864c80274171493c985d83d4ea7ac351e93dc09d13238d00ee825d6
|
data/README.md
CHANGED
|
@@ -104,9 +104,11 @@ SolidQueueMonitor.setup do |config|
|
|
|
104
104
|
config.authentication_enabled = false
|
|
105
105
|
|
|
106
106
|
# Set the username for HTTP Basic Authentication (only used if authentication is enabled)
|
|
107
|
+
# Supports static values, ENV variables, or callables (Proc/Lambda)
|
|
107
108
|
config.username = 'admin'
|
|
108
109
|
|
|
109
110
|
# Set the password for HTTP Basic Authentication (only used if authentication is enabled)
|
|
111
|
+
# Supports static values, ENV variables, or callables (Proc/Lambda)
|
|
110
112
|
config.password = 'password'
|
|
111
113
|
|
|
112
114
|
# Number of jobs to display per page
|
|
@@ -141,7 +143,21 @@ By default, Solid Queue Monitor does not require authentication to access the da
|
|
|
141
143
|
For production environments, it's strongly recommended to enable authentication:
|
|
142
144
|
|
|
143
145
|
1. **Enable authentication**: Set `config.authentication_enabled = true` in the initializer
|
|
144
|
-
2. **Configure secure credentials
|
|
146
|
+
2. **Configure secure credentials** using any of these approaches:
|
|
147
|
+
|
|
148
|
+
```ruby
|
|
149
|
+
# Static values
|
|
150
|
+
config.username = 'admin'
|
|
151
|
+
config.password = 'secure_password'
|
|
152
|
+
|
|
153
|
+
# Environment variables
|
|
154
|
+
config.username = ENV['SOLID_QUEUE_MONITOR_USERNAME']
|
|
155
|
+
config.password = ENV['SOLID_QUEUE_MONITOR_PASSWORD']
|
|
156
|
+
|
|
157
|
+
# Rails credentials (use a lambda for deferred evaluation)
|
|
158
|
+
config.username = -> { Rails.application.credentials.dig(:solid_queue_monitor, :username) }
|
|
159
|
+
config.password = -> { Rails.application.credentials.dig(:solid_queue_monitor, :password) }
|
|
160
|
+
```
|
|
145
161
|
|
|
146
162
|
## Usage
|
|
147
163
|
|
|
@@ -81,16 +81,19 @@ module SolidQueueMonitor
|
|
|
81
81
|
# Cross-DB bucket index expression.
|
|
82
82
|
# PostgreSQL: CAST((EXTRACT(EPOCH FROM col) - start) / interval AS INTEGER)
|
|
83
83
|
# SQLite: CAST((CAST(strftime('%s', col) AS INTEGER) - start) / interval AS INTEGER)
|
|
84
|
+
# MySQL: CAST((UNIX_TIMESTAMP(col) - start) / interval AS SIGNED)
|
|
84
85
|
def bucket_index_expr(column, start_epoch, interval_seconds)
|
|
85
|
-
if sqlite
|
|
86
|
+
if adapter?('sqlite')
|
|
86
87
|
"CAST((CAST(strftime('%s', #{column}) AS INTEGER) - #{start_epoch}) / #{interval_seconds} AS INTEGER)"
|
|
88
|
+
elsif adapter?('mysql')
|
|
89
|
+
"CAST((UNIX_TIMESTAMP(#{column}) - #{start_epoch}) / #{interval_seconds} AS SIGNED)"
|
|
87
90
|
else
|
|
88
91
|
"CAST((EXTRACT(EPOCH FROM #{column}) - #{start_epoch}) / #{interval_seconds} AS INTEGER)"
|
|
89
92
|
end
|
|
90
93
|
end
|
|
91
94
|
|
|
92
|
-
def
|
|
93
|
-
ActiveRecord::Base.connection.adapter_name.downcase.include?(
|
|
95
|
+
def adapter?(name)
|
|
96
|
+
ActiveRecord::Base.connection.adapter_name.downcase.include?(name)
|
|
94
97
|
end
|
|
95
98
|
end
|
|
96
99
|
end
|
|
@@ -7,9 +7,13 @@ SolidQueueMonitor.setup do |config|
|
|
|
7
7
|
|
|
8
8
|
# Set the username for HTTP Basic Authentication (only used if authentication is enabled)
|
|
9
9
|
# config.username = 'admin'
|
|
10
|
+
# config.username = ENV['SOLID_QUEUE_MONITOR_USERNAME']
|
|
11
|
+
# config.username = -> { Rails.application.credentials.dig(:solid_queue_monitor, :username) }
|
|
10
12
|
|
|
11
13
|
# Set the password for HTTP Basic Authentication (only used if authentication is enabled)
|
|
12
14
|
# config.password = 'password'
|
|
15
|
+
# config.password = ENV['SOLID_QUEUE_MONITOR_PASSWORD']
|
|
16
|
+
# config.password = -> { Rails.application.credentials.dig(:solid_queue_monitor, :password) }
|
|
13
17
|
|
|
14
18
|
# Number of jobs to display per page
|
|
15
19
|
# config.jobs_per_page = 25
|
data/lib/solid_queue_monitor.rb
CHANGED
|
@@ -6,8 +6,23 @@ require_relative 'solid_queue_monitor/engine'
|
|
|
6
6
|
module SolidQueueMonitor
|
|
7
7
|
class Error < StandardError; end
|
|
8
8
|
class << self
|
|
9
|
-
|
|
9
|
+
attr_writer :username, :password
|
|
10
|
+
attr_accessor :jobs_per_page, :authentication_enabled,
|
|
10
11
|
:auto_refresh_enabled, :auto_refresh_interval, :show_chart
|
|
12
|
+
|
|
13
|
+
def username
|
|
14
|
+
resolve_value(@username)
|
|
15
|
+
end
|
|
16
|
+
|
|
17
|
+
def password
|
|
18
|
+
resolve_value(@password)
|
|
19
|
+
end
|
|
20
|
+
|
|
21
|
+
private
|
|
22
|
+
|
|
23
|
+
def resolve_value(value)
|
|
24
|
+
value.respond_to?(:call) ? value.call : value
|
|
25
|
+
end
|
|
11
26
|
end
|
|
12
27
|
|
|
13
28
|
@username = 'admin'
|