Files
archived-hc-harbor/app/controllers/api/internal/application_controller.rb
2025-06-08 18:54:59 -04:00

21 lines
522 B
Ruby

module Api
module Internal
class ApplicationController < ActionController::API
include ActionController::HttpAuthentication::Token::ControllerMethods
before_action :authenticate!
private
def authenticate!
res = authenticate_with_http_token do |token, _|
ENV["INTERNAL_API_KEYS"]&.split(",")&.include?(token)
end
unless res
redirect_to "https://www.youtube.com/watch?v=dQw4w9WgXcQ", allow_other_host: true
end
end
end
end
end