Sha256: b9eadf83d3c8ceb991a00d01fcb827ddbb88111a1639f8ca436c49c12859d7bc

Contents?: true

Size: 598 Bytes

Versions: 6

Compression:

Stored size: 598 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"
        false
      end

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

Version data entries

6 entries across 6 versions & 1 rubygems

Version Path
peak_flow_utils-0.1.17 app/controllers/peak_flow_utils/application_controller.rb
peak_flow_utils-0.1.16 app/controllers/peak_flow_utils/application_controller.rb
peak_flow_utils-0.1.15 app/controllers/peak_flow_utils/application_controller.rb
peak_flow_utils-0.1.14 app/controllers/peak_flow_utils/application_controller.rb
peak_flow_utils-0.1.13 app/controllers/peak_flow_utils/application_controller.rb
peak_flow_utils-0.1.12 app/controllers/peak_flow_utils/application_controller.rb