# 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