main
 1module Api
 2  module V1
 3    class ApiController < ApplicationController
 4      before_action :authenticate
 5      skip_before_action :verify_authenticity_token
 6      skip_before_action :ensure_valid_session
 7      attr_reader :current_environment
 8
 9      private
10
11      def authenticate
12        authenticate_or_request_with_http_token do |token, options|
13          @current_environment = Environment.find_by(api_key: token)
14        end
15      end
16    end
17  end
18end