Class: RailsPgExtras::Web::ApplicationController
- Inherits:
-
ActionController::Base
- Object
- ActionController::Base
- RailsPgExtras::Web::ApplicationController
show all
- Defined in:
- app/controllers/rails_pg_extras/web/application_controller.rb
Constant Summary
collapse
- REQUIRED_EXTENSIONS =
{
pg_stat_statements: %i[calls outliers pg_stat_statements_reset],
pg_buffercache: %i[buffercache_stats buffercache_usage],
sslinfo: %i[ssl_used],
}
- ACTIONS =
%i[kill_all pg_stat_statements_reset add_extensions]
Class Method Summary
collapse
Instance Method Summary
collapse
Class Method Details
.get_password ⇒ Object
10
11
12
|
# File 'app/controllers/rails_pg_extras/web/application_controller.rb', line 10
def self.get_password
Rails.application.try(:credentials).try(:pg_extras).try(:password) || ENV["RAILS_PG_EXTRAS_PASSWORD"]
end
|
.get_user ⇒ Object
6
7
8
|
# File 'app/controllers/rails_pg_extras/web/application_controller.rb', line 6
def self.get_user
Rails.application.try(:credentials).try(:pg_extras).try(:user) || ENV["RAILS_PG_EXTRAS_USER"]
end
|
Instance Method Details
#validate_credentials! ⇒ Object
29
30
31
32
33
|
# File 'app/controllers/rails_pg_extras/web/application_controller.rb', line 29
def validate_credentials!
if (self.class.get_user.blank? || self.class.get_password.blank?) && RailsPgExtras.configuration.public_dashboard != true
raise "Missing credentials for rails-pg-extras dashboard! If you want to enable public dashboard please set RAILS_PG_EXTRAS_PUBLIC_DASHBOARD=true"
end
end
|