class Aliyun::Log::Config

Attributes

access_key_id[RW]
access_key_secret[RW]
endpoint[RW]
log_file[RW]
log_level[RW]
open_timeout[RW]
project[RW]
read_timeout[RW]
timestamps[RW]

Public Class Methods

configure() { |self| ... } click to toggle source
# File lib/aliyun/log/config.rb, line 18
def configure
  yield self
end
new(opts = {}) click to toggle source
Calls superclass method Aliyun::Log::Common::AttrStruct::new
# File lib/aliyun/log/config.rb, line 26
def initialize(opts = {})
  super(opts)
  @open_timeout ||= self.class.open_timeout
  @read_timeout ||= self.class.read_timeout
  @access_key_id ||= self.class.access_key_id
  @access_key_secret ||= self.class.access_key_secret
  @endpoint ||= self.class.endpoint
  normalize_endpoint
  raise 'Missing AccessKeyID or AccessKeySecret' if @access_key_id.nil? || @access_key_secret.nil?
end

Private Instance Methods

normalize_endpoint() click to toggle source
# File lib/aliyun/log/config.rb, line 39
def normalize_endpoint
  uri = URI.parse(endpoint)
  uri = URI.parse("http://#{endpoint}") unless uri.scheme

  raise 'Only HTTP and HTTPS endpoint are accepted.' if (uri.scheme != 'http') && (uri.scheme != 'https')

  @endpoint = uri.to_s
end