Method: Superbot::Cloud.authorization_header

Defined in:
lib/superbot/cloud.rb

.authorization_headerObject



37
38
39
40
41
42
43
44
45
46
47
48
# File 'lib/superbot/cloud.rb', line 37

def self.authorization_header
  @authorization_header ||= format(
    '%<auth_type>s %<auth_token>s',
    auth_type: ENV['SUPERBOT_TOKEN'] ? 'Bearer' : 'Basic',
    auth_token: Base64.urlsafe_encode64(
      ENV.fetch(
        'SUPERBOT_TOKEN',
        credentials&.values_at(:username, :token)&.join(':').to_s
      )
    )
  )
end