Module: Cyclid::UI::Health::API

Defined in:
app/cyclid_ui/controllers/health.rb

Overview

Internal API connection health check

Class Method Summary collapse

Class Method Details

.statusObject

Check if we can connect to the Cyclid API



76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
# File 'app/cyclid_ui/controllers/health.rb', line 76

def self.status
  connected = begin
                client = Client::Tilapia.new(auth: Client::AUTH_NONE,
                                             log_level: Logger::DEBUG,
                                             server: Cyclid.config.server_api.host,
                                             port: Cyclid.config.server_api.port)
                client.health_ping
              rescue
                false
              end

  if connected
    SinatraHealthCheck::Status.new(:ok, 'API connection is okay')
  else
    SinatraHealthCheck::Status.new(:error, 'API is not available')
  end
end