Class: Forem::Services::HealthCheckService

Inherits:
BaseService
  • Object
show all
Defined in:
lib/forem/services/health_check_service.rb

Overview

Service for interacting with the Forem Health Check API.

In production these endpoints require the health-check-token header — pass token: to each call. On localhost the token is bypassed by Forem core, so a local development instance accepts unauthenticated calls.

Examples:

Production

client.health_checks.app(token: ENV["FOREM_HEALTH_CHECK_TOKEN"])

Local development (token not required for localhost)

client.health_checks.app

See Also:

Instance Method Summary collapse

Methods inherited from BaseService

#initialize

Constructor Details

This class inherits a constructor from Forem::Services::BaseService

Instance Method Details

#app(token: nil, **opts) ⇒ Forem::ForemObject

Application-server health.

Parameters:

  • token (String, nil) (defaults to: nil)

    value for the health-check-token header (required in production; bypassed on localhost).

  • opts (Hash)

    per-request options

Returns:



25
26
27
# File 'lib/forem/services/health_check_service.rb', line 25

def app(token: nil, **opts)
  HealthCheck.app(token: token, **opts_with_requestor(opts))
end

#cache(token: nil, **opts) ⇒ Forem::ForemObject

Cache (Redis) connectivity & responsiveness.

Parameters:

  • token (String, nil) (defaults to: nil)

    value for the health-check-token header.

  • opts (Hash)

    per-request options

Returns:



41
42
43
# File 'lib/forem/services/health_check_service.rb', line 41

def cache(token: nil, **opts)
  HealthCheck.cache(token: token, **opts_with_requestor(opts))
end

#database(token: nil, **opts) ⇒ Forem::ForemObject

Database connectivity & responsiveness.

Parameters:

  • token (String, nil) (defaults to: nil)

    value for the health-check-token header.

  • opts (Hash)

    per-request options

Returns:



33
34
35
# File 'lib/forem/services/health_check_service.rb', line 33

def database(token: nil, **opts)
  HealthCheck.database(token: token, **opts_with_requestor(opts))
end