Sha256: ced5426dcc77e53204f61426352fb8268b7deb812fe63019a717937b7e1c7783

Contents?: true

Size: 1.26 KB

Versions: 4

Compression:

Stored size: 1.26 KB

Contents

# Copyright Cloudinary
require "ostruct"
require "cloudinary/version"
require "cloudinary/utils"
require "cloudinary/uploader"
require "cloudinary/downloader"
require "cloudinary/blob" 
require "cloudinary/static" 
require 'active_support' 
require "cloudinary/missing"
require "cloudinary/carrier_wave" if defined?(::CarrierWave)
require "cloudinary/helper" if defined?(::ActionView::Base)
require "cloudinary/controller" if defined?(::ActionController::Base)
require "cloudinary/railtie" if defined?(Rails) && defined?(Rails::Railtie)

module Cloudinary  
  @@config = nil
  
  def self.config(new_config=nil)    
    @@config = new_config if new_config
    if block_given?
      @@config = OpenStruct.new
      yield(@@config)
    end 
    # Heroku support
    if @@config.nil? && ENV["CLOUDINARY_CLOUD_NAME"]
      @@config = OpenStruct.new(
        "cloud_name" => ENV["CLOUDINARY_CLOUD_NAME"],
        "api_key" => ENV["CLOUDINARY_API_KEY"],
        "api_secret" => ENV["CLOUDINARY_API_SECRET"],
        "secure_distribution" => ENV["CLOUDINARY_SECURE_DISTRIBUTION"],
        "private_cdn" => ENV["CLOUDINARY_PRIVATE_CDN"].to_s == 'true'
      )
    end    
    @@config ||= OpenStruct.new((YAML.load_file(Rails.root.join("config").join("cloudinary.yml"))[Rails.env] rescue {}))
  end
end

Version data entries

4 entries across 4 versions & 1 rubygems

Version Path
cloudinary-1.0.9 lib/cloudinary.rb
cloudinary-1.0.8 lib/cloudinary.rb
cloudinary-1.0.7 lib/cloudinary.rb
cloudinary-1.0.6 lib/cloudinary.rb