Sha256: dc406609d85aca24c139691a4808f02a92ef44e3febb494e4b9533b3aea380de

Contents?: true

Size: 605 Bytes

Versions: 2

Compression:

Stored size: 605 Bytes

Contents

class PeakFlowUtils::ApplicationController < ActionController::Base
  protect_from_forgery with: :exception

  before_action :authenticate

private

  def authenticate
    authenticate_or_request_with_http_basic do |username, password|
      if ENV["PEAKFLOW_PINGS_USERNAME"].blank? || ENV["PEAKFLOW_PINGS_PASSWORD"].blank?
        Rails.logger.error "Peakflow utils: Pings called but PEAKFLOW_PINGS_USERNAME or PEAKFLOW_PINGS_PASSWORD wasn't set"
        return false
      end

      username == ENV.fetch("PEAKFLOW_PINGS_USERNAME") && password == ENV.fetch("PEAKFLOW_PINGS_PASSWORD")
    end
  end
end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
peak_flow_utils-0.1.19 app/controllers/peak_flow_utils/application_controller.rb
peak_flow_utils-0.1.18 app/controllers/peak_flow_utils/application_controller.rb