rails-pg-extras 5.5.0 → 5.5.1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/README.md +1 -1
- data/app/controllers/rails_pg_extras/web/application_controller.rb +11 -16
- data/lib/rails_pg_extras/version.rb +1 -1
- metadata +3 -3
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 8bb397d676884df226763f0b5e11046dae35f31e434e1dc9fbee727d71542b36
|
4
|
+
data.tar.gz: 533fcb32dbdac4eb85601c0a9e194175370f37ab9245bae20b2a0c6cc18d50ce
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 2f1eb7423937f8ffebaac99e65451cb9dbc5ba9f7cf6489ef7a4bd1042b4f5db108de08f4e1d41ec7ccd847a95af4c7d5abbc780a50161b6791c5e20aeade994
|
7
|
+
data.tar.gz: 9c2e23d4fbe6ea97b4c217648dab172de9f46d67a07587b00c2c0bfd1f9f0cc70336aa26b4ab09e85dd60d1be95d6cd8c611df95904b47a1e90dab6ddc881798
|
data/README.md
CHANGED
@@ -135,7 +135,7 @@ You can enable UI using a Rails engine by adding the following code in `config/r
|
|
135
135
|
mount RailsPgExtras::Web::Engine, at: 'pg_extras'
|
136
136
|
```
|
137
137
|
|
138
|
-
You can enable HTTP basic auth by specifying `Rails.application.credentials.pg_extras.user` (or `RAILS_PG_EXTRAS_USER`) and `Rails.application.credentials.pg_extras.
|
138
|
+
You can enable HTTP basic auth by specifying `Rails.application.credentials.pg_extras.user` (or `RAILS_PG_EXTRAS_USER`) and `Rails.application.credentials.pg_extras.password` (or `RAILS_PG_EXTRAS_PASSWORD`) values. Authentication is mandatory unless you specify `RAILS_PG_EXTRAS_PUBLIC_DASHBOARD=true` or set `RailsPgExtras.configuration.public_dashboard = true`.
|
139
139
|
|
140
140
|
You can configure available web actions in `config/initializers/rails_pg_extras.rb`:
|
141
141
|
|
@@ -3,6 +3,14 @@ require "rails_pg_extras/version"
|
|
3
3
|
|
4
4
|
module RailsPgExtras::Web
|
5
5
|
class ApplicationController < ActionController::Base
|
6
|
+
def self.get_user
|
7
|
+
Rails.application.try(:credentials).try(:pg_extras).try(:user) || ENV["RAILS_PG_EXTRAS_USER"]
|
8
|
+
end
|
9
|
+
|
10
|
+
def self.get_password
|
11
|
+
Rails.application.try(:credentials).try(:pg_extras).try(:password) || ENV["RAILS_PG_EXTRAS_PASSWORD"]
|
12
|
+
end
|
13
|
+
|
6
14
|
before_action :validate_credentials!
|
7
15
|
layout "rails_pg_extras/web/application"
|
8
16
|
|
@@ -14,27 +22,14 @@ module RailsPgExtras::Web
|
|
14
22
|
|
15
23
|
ACTIONS = %i[kill_all pg_stat_statements_reset add_extensions]
|
16
24
|
|
17
|
-
|
18
|
-
|
19
|
-
|
20
|
-
if user.present? && password.present?
|
21
|
-
http_basic_authenticate_with name: user, password: password
|
25
|
+
if get_user.present? && get_password.present?
|
26
|
+
http_basic_authenticate_with name: get_user, password: get_password
|
22
27
|
end
|
23
28
|
|
24
29
|
def validate_credentials!
|
25
|
-
if (get_user.blank? || get_password.blank?) && RailsPgExtras.configuration.public_dashboard != true
|
30
|
+
if (self.class.get_user.blank? || self.class.get_password.blank?) && RailsPgExtras.configuration.public_dashboard != true
|
26
31
|
raise "Missing credentials for rails-pg-extras dashboard! If you want to enable public dashboard please set RAILS_PG_EXTRAS_PUBLIC_DASHBOARD=true"
|
27
32
|
end
|
28
33
|
end
|
29
|
-
|
30
|
-
private
|
31
|
-
|
32
|
-
def get_user
|
33
|
-
Rails.application.try(:credentials).try(:pg_extras).try(:user) || ENV["RAILS_PG_EXTRAS_USER"]
|
34
|
-
end
|
35
|
-
|
36
|
-
def get_password
|
37
|
-
Rails.application.try(:credentials).try(:pg_extras).try(:password) || ENV["RAILS_PG_EXTRAS_PASSWORD"]
|
38
|
-
end
|
39
34
|
end
|
40
35
|
end
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: rails-pg-extras
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 5.5.
|
4
|
+
version: 5.5.1
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- pawurb
|
@@ -16,14 +16,14 @@ dependencies:
|
|
16
16
|
requirements:
|
17
17
|
- - '='
|
18
18
|
- !ruby/object:Gem::Version
|
19
|
-
version: 5.5.
|
19
|
+
version: 5.5.1
|
20
20
|
type: :runtime
|
21
21
|
prerelease: false
|
22
22
|
version_requirements: !ruby/object:Gem::Requirement
|
23
23
|
requirements:
|
24
24
|
- - '='
|
25
25
|
- !ruby/object:Gem::Version
|
26
|
-
version: 5.5.
|
26
|
+
version: 5.5.1
|
27
27
|
- !ruby/object:Gem::Dependency
|
28
28
|
name: rails
|
29
29
|
requirement: !ruby/object:Gem::Requirement
|