summaryrefslogtreecommitdiff
path: root/app/controllers/api/v1/api_controller.rb
blob: 8191cbfe896378b3d701635ad406b476a5ff0d0e (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
module Api
  module V1
    class ApiController < ApplicationController
      before_action :authenticate
      skip_before_action :verify_authenticity_token
      skip_before_action :ensure_valid_session
      attr_reader :current_environment

      private

      def authenticate
        authenticate_or_request_with_http_token do |token, options|
          @current_environment = Environment.find_by(api_key: token)
        end
      end
    end
  end
end