Sha256: 47760c643804a97a4a7a82aeefee43d16afd6e5a3f7c970ca14e0da1b94640dc

Contents?: true

Size: 680 Bytes

Versions: 1

Compression:

Stored size: 680 Bytes

Contents

class HealthRails::HealthController < ApplicationController
  before_filter :login_required

  # GET /health
  def index
    health_check = HealthRails::HealthCheck.new
    if health_check.all_ok?
      render text: "All OK"
    else
      render text: health_check.error_messages, status: :service_unavailable
    end
  end

  private
    def login_required
      if HealthRails.authentication
        authenticate_or_request_with_http_basic("#{Rails.application.class.parent_name}'s health is important to us!") do |username, password|
          HealthRails.authentication.has_key?(username) && HealthRails.authentication[username] == password
        end
      end
    end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
health_rails-0.0.2 app/controllers/health_rails/health_controller.rb