module OkComputer
Private: Storage of the checks which have been registered with OkComputer
.
No one is expected to interact directly with this class, but rather through the outer OkComputer
interface.
Constants
- VERSION
Attributes
Public: Option to disable third-party app performance tools (.e.g NewRelic) from counting OkComputer
routes towards their total.
Public: whether to execute checks in parallel.
Public: Logger to use to log check results
Public: The route to automatically mount the OkComputer
engine. Setting to false prevents OkComputer
from automatically mounting itself.
Private: The options container
Private: The password for access to checks
Private: The username for access to checks
Public Class Methods
Source
# File lib/ok_computer/configuration.rb, line 28 def self.authenticate(username_try, password_try) return true unless requires_authentication? username == username_try && password == password_try end
Public: Attempt to authenticate against required username and password
username - Username to authenticate with password - Password to authenticate with
Returns a Boolean
Source
# File lib/ok_computer/configuration.rb, line 44 def self.make_optional(checks) checks.each do |check| OkComputer::Registry.register check, OkComputer::OptionalCheck.new(OkComputer::Registry.fetch(check)) end end
Public: Mark listed checks as optional
Source
# File lib/ok_computer/configuration.rb, line 16 def self.require_authentication(username, password, options = {}) self.username = username self.password = password self.options = options end
Public: Configure HTTP Basic authentication
username - Username required to view checks password - Password required to view checks options - Hash of additional options
- except - Array of checks to skip authentication for
Examples:
OkComputer.require_authentication("foo", "bar") # => Require authentication with foo:bar for all checks OkComputer.require_authentication("foo", "bar", except: %w(default nonsecret)) # => Require authentication with foo:bar for all checks except the checks named "default" and "nonsecret"
Source
# File lib/ok_computer/configuration.rb, line 37 def self.requires_authentication?(params={}) return false if params[:action] == "show" && whitelist.include?(params[:check]) username && password end
Public: Whether OkComputer
is configured to require authentication
Returns a Boolean
Source
# File lib/ok_computer/configuration.rb, line 74 def whitelist options.fetch(:except) { [] } end
Private: Configure a whitelist of checks to skip authentication