Class: Forem::HealthCheck
- Inherits:
-
APIResource
- Object
- ForemObject
- APIResource
- Forem::HealthCheck
- Defined in:
- lib/forem/resources/health_check.rb
Overview
Provides access to the health-check endpoints of a Forem instance.
Health checks let you verify that the various subsystems of a Forem deployment are operational. There are three separate checks: the application server, the database, and the cache layer.
Authentication
In production, the endpoints require an health-check-token header
whose value matches the instance's
Settings::General.health_check_token setting. The Forem controller
bypasses the token check for requests originating from localhost,
so a local-development instance accepts unauthenticated calls.
Pass the token via the token: keyword on each method (or on the
service-level wrapper). The api-key header is not used by these
endpoints — the token is a separate, dedicated mechanism.
Constant Summary collapse
- OBJECT_NAME =
"health_check"- RESOURCE_PATH =
"/api/health_checks"
Instance Attribute Summary
Attributes inherited from ForemObject
Class Method Summary collapse
-
.app(token: nil, **opts) ⇒ Forem::ForemObject
Application-server health.
-
.cache(token: nil, **opts) ⇒ Forem::ForemObject
Cache (Redis) connectivity & responsiveness.
-
.database(token: nil, **opts) ⇒ Forem::ForemObject
Database connectivity & responsiveness.
Methods inherited from APIResource
#refresh, resource_path, #resource_url
Methods inherited from ForemObject
#==, #[], #[]=, construct_from, cursor_list, #initialize, #inspect, #method_missing, paginated_list, #respond_to_missing?, #to_hash
Methods included from APIOperations::Request
Constructor Details
This class inherits a constructor from Forem::ForemObject
Dynamic Method Handling
This class handles dynamic methods through the method_missing method in the class Forem::ForemObject
Class Method Details
.app(token: nil, **opts) ⇒ Forem::ForemObject
Application-server health.
38 39 40 |
# File 'lib/forem/resources/health_check.rb', line 38 def self.app(token: nil, **opts) check("/api/health_checks/app", token, opts) end |
.cache(token: nil, **opts) ⇒ Forem::ForemObject
Cache (Redis) connectivity & responsiveness.
54 55 56 |
# File 'lib/forem/resources/health_check.rb', line 54 def self.cache(token: nil, **opts) check("/api/health_checks/cache", token, opts) end |
.database(token: nil, **opts) ⇒ Forem::ForemObject
Database connectivity & responsiveness.
46 47 48 |
# File 'lib/forem/resources/health_check.rb', line 46 def self.database(token: nil, **opts) check("/api/health_checks/database", token, opts) end |