Method: Cloudinary::BaseConfig#load_from_url

Defined in:
lib/cloudinary/base_config.rb

#load_from_url(url) ⇒ Object



3
4
5
6
7
8
9
10
11
12
13
14
15
16
# File 'lib/cloudinary/base_config.rb', line 3

def load_from_url(url)
  return unless url && !url.empty?

  parsed_url = URI.parse(url)
  scheme = parsed_url.scheme.to_s.downcase

  if expected_scheme != scheme
    raise(CloudinaryException,
          "Invalid #{env_url} scheme. Expecting to start with '#{expected_scheme}://'")
  end

  update(config_from_parsed_url(parsed_url))
  setup_from_parsed_url(parsed_url)
end