Module: OkComputer
- Defined in:
- lib/ok_computer/registry.rb,
lib/ok_computer/check.rb,
lib/ok_computer/engine.rb,
lib/ok_computer/version.rb,
lib/ok_computer/configuration.rb,
lib/ok_computer/check_collection.rb,
lib/ok_computer/built_in_checks/http_check.rb,
lib/ok_computer/built_in_checks/solr_check.rb,
lib/ok_computer/built_in_checks/cache_check.rb,
lib/ok_computer/built_in_checks/redis_check.rb,
lib/ok_computer/built_in_checks/default_check.rb,
lib/ok_computer/built_in_checks/mongoid_check.rb,
lib/ok_computer/built_in_checks/app_version_check.rb,
lib/ok_computer/built_in_checks/resque_down_check.rb,
app/controllers/ok_computer/ok_computer_controller.rb,
lib/ok_computer/built_in_checks/ruby_version_check.rb,
lib/ok_computer/built_in_checks/active_record_check.rb,
lib/ok_computer/built_in_checks/elasticsearch_check.rb,
lib/ok_computer/built_in_checks/generic_cache_check.rb,
lib/ok_computer/built_in_checks/size_threshold_check.rb,
lib/ok_computer/built_in_checks/sidekiq_latency_check.rb,
lib/ok_computer/built_in_checks/resque_backed_up_check.rb,
lib/ok_computer/built_in_checks/mongoid_replica_set_check.rb,
lib/ok_computer/built_in_checks/delayed_job_backed_up_check.rb,
lib/ok_computer/built_in_checks/resque_failure_threshold_check.rb
Overview
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.
Defined Under Namespace
Classes: ActiveRecordCheck, AppVersionCheck, CacheCheck, Check, CheckCollection, DefaultCheck, DelayedJobBackedUpCheck, ElasticsearchCheck, Engine, GenericCacheCheck, HttpCheck, MongoidCheck, MongoidReplicaSetCheck, OkComputerController, RedisCheck, Registry, ResqueBackedUpCheck, ResqueDownCheck, ResqueFailureThresholdCheck, RubyVersionCheck, SidekiqLatencyCheck, SizeThresholdCheck, SolrCheck
Constant Summary collapse
- VERSION =
'1.6.2'
Class Method Summary collapse
-
.authenticate(username_try, password_try) ⇒ Object
Public: Attempt to authenticate against required username and password.
-
.require_authentication(username, password, options = {}) ⇒ Object
Public: Configure HTTP Basic authentication.
-
.requires_authentication?(params = {}) ⇒ Boolean
Public: Whether OkComputer is configured to require authentication.
-
.whitelist ⇒ Object
Private: Configure a whitelist of checks to skip authentication.
Class Method Details
.authenticate(username_try, password_try) ⇒ Object
Public: Attempt to authenticate against required username and password
username - Username to authenticate with password - Password to authenticate with
Returns a Boolean
28 29 30 31 32 |
# 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 |
.require_authentication(username, password, options = {}) ⇒ Object
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"
16 17 18 19 20 |
# File 'lib/ok_computer/configuration.rb', line 16 def self.require_authentication(username, password, = {}) self.username = username self.password = password self. = end |
.requires_authentication?(params = {}) ⇒ Boolean
Public: Whether OkComputer is configured to require authentication
Returns a Boolean
37 38 39 40 41 |
# 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 |
.whitelist ⇒ Object
Private: Configure a whitelist of checks to skip authentication
71 72 73 |
# File 'lib/ok_computer/configuration.rb', line 71 def self.whitelist .fetch(:except) { [] } end |