Sha256: b73f48388154960ecb506ca54d0b59ed5ff76da355480b2596d0088efc6f5e82

Contents?: true

Size: 561 Bytes

Versions: 2

Compression:

Stored size: 561 Bytes

Contents

# frozen_string_literal: true

module MintPingApi
  class PingsController < ::ApplicationController
    before_action :authenticate

    def show
      if request.headers[Figaro.env.MINT_API_TOKEN_KEY] == Figaro.env.MINT_API_TOKEN_VALUE
        render plain: 'OK'
      else
        render nothing: true, status: :service_unavailable
      end
    end

    def authenticate
      authenticate_or_request_with_http_basic do |username, password|
        username == Figaro.env.MINT_API_USER && password == Figaro.env.MINT_API_PASSWORD
      end
    end
  end
end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
mint_ping_api-1.1.0 app/controllers/mint_ping_api/pings_controller.rb
mint_ping_api-1.0.0 app/controllers/mint_ping_api/pings_controller.rb