rails-pg-extras 4.7.2 → 4.8.1

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: e8ff8965c70e032317fe7493fa9920d50093256786947e4f067a525cbeba2335
4
- data.tar.gz: 9a60fe177acaf1f7af17f3fb13b82609ddbca6c50e4fa07cc75360d5935d1173
3
+ metadata.gz: acfc146396c33697f24aa0e96d251c77fd94e2a5d10a8154dcff9df02a981ac8
4
+ data.tar.gz: 5290474635b58a4e35afd3c075726b24e75a6194acd691e5b90b5b3289f2b5f1
5
5
  SHA512:
6
- metadata.gz: 42cddd0263993de94149b63ebb5b6deba395a0b1962881ddecda38a7d52f842b812ed65a30c1825e8f6c5f1667475961a22a9597c270f51139ba71f750dc67e7
7
- data.tar.gz: 3f73876c3a17b116dd995ab3af09622e7262db6e533e28108170015fdf369aad41b190cabab7b2f54aa64b034a1ea49bacc1816995a953a3ea495d15de719bfd
6
+ metadata.gz: 3db2562f135d7b904239f5481d5050f1404062b679fa9dc1399379bea58f66c981d7adadee8d5af34ff4e5c0ffc10f6cd1de2c3fab03923083c45fa11d24785b
7
+ data.tar.gz: 91b734c2c9bc9e6678d50def9cc4603e5444f35b16ec90514e14644954fa1d8d8e4b014c287dc2beb2cb9edfc3cadd29f517ad3f4fd42a37872304b91c5c553b
data/README.md CHANGED
@@ -119,7 +119,7 @@ You can enable UI using a Rails engine by adding the following code in `config/r
119
119
  mount RailsPgExtras::Web::Engine, at: 'pg_extras'
120
120
  ```
121
121
 
122
- You can enable HTTP basic auth by specifying `RAILS_PG_EXTRAS_USER` and `RAILS_PG_EXTRAS_PASSWORD` variables.
122
+ You can enable HTTP basic auth by specifying `RAILS_PG_EXTRAS_USER` and `RAILS_PG_EXTRAS_PASSWORD` variables. Authentication is mandatory unless you specify `RAILS_PG_EXTRAS_PUBLIC_DASHBOARD=true`.
123
123
 
124
124
  You can configure available web actions in `config/initializers/rails_pg_extras.rb`:
125
125
 
@@ -3,6 +3,7 @@ require "rails_pg_extras/version"
3
3
 
4
4
  module RailsPgExtras::Web
5
5
  class ApplicationController < ActionController::Base
6
+ before_action :validate_credentials!
6
7
  layout "rails_pg_extras/web/application"
7
8
 
8
9
  REQUIRED_EXTENSIONS = {
@@ -14,7 +15,13 @@ module RailsPgExtras::Web
14
15
  ACTIONS = %i[kill_all pg_stat_statements_reset add_extensions]
15
16
 
16
17
  if ENV['RAILS_PG_EXTRAS_USER'].present? && ENV['RAILS_PG_EXTRAS_PASSWORD'].present?
17
- http_basic_authenticate_with name: ENV['RAILS_PG_EXTRAS_USER'], password: ENV['RAILS_PG_EXTRAS_PASSWORD']
18
+ http_basic_authenticate_with name: ENV.fetch('RAILS_PG_EXTRAS_USER'), password: ENV.fetch('RAILS_PG_EXTRAS_PASSWORD')
19
+ end
20
+
21
+ def validate_credentials!
22
+ if (ENV['RAILS_PG_EXTRAS_USER'].blank? || ENV['RAILS_PG_EXTRAS_PASSWORD'].blank?) && ENV["RAILS_PG_EXTRAS_PUBLIC_DASHBOARD"] != "true"
23
+ raise "Missing credentials for rails-pg-extras dashboard! If you want to enable public dashboard please set RAILS_PG_EXTRAS_PUBLIC_DASHBOARD=true"
24
+ end
18
25
  end
19
26
  end
20
27
  end
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module RailsPgExtras
4
- VERSION = "4.7.2"
4
+ VERSION = "4.8.1"
5
5
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: rails-pg-extras
3
3
  version: !ruby/object:Gem::Version
4
- version: 4.7.2
4
+ version: 4.8.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - pawurb
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2022-07-08 00:00:00.000000000 Z
11
+ date: 2022-07-19 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: ruby-pg-extras
@@ -16,14 +16,14 @@ dependencies:
16
16
  requirements:
17
17
  - - '='
18
18
  - !ruby/object:Gem::Version
19
- version: 4.7.2
19
+ version: 4.8.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: 4.7.2
26
+ version: 4.8.1
27
27
  - !ruby/object:Gem::Dependency
28
28
  name: rails
29
29
  requirement: !ruby/object:Gem::Requirement