Welcome to mirror list, hosted at ThFree Co, Russian Federation.

personal_access_token_cache.rb « resource « qa « qa - gitlab.com/gitlab-org/gitlab-foss.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
blob: 078df8e6779c197d45a5054bb0926bb603787199 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
# frozen_string_literal: true

module QA
  module Resource
    class PersonalAccessTokenCache
      @personal_access_tokens = {}

      def self.get_token_for_username(username)
        token = @personal_access_tokens[username]

        log_message = if token
                        %[Retrieved cached token for username: #{username}, last six chars of token:#{token[-6..]}]
                      else
                        %[No cached token found for username: #{username}]
                      end

        QA::Runtime::Logger.info(log_message)

        token
      end

      def self.set_token_for_username(username, token)
        QA::Runtime::Logger.info(%[Caching token for username: #{username}, last six chars of token:#{token[-6..]}])
        @personal_access_tokens[username] = token
      end
    end
  end
end