Skip to content

Commit

Permalink
Renamed config property cloud_dist_id to cloudfront_dist_id for
Browse files Browse the repository at this point in the history
consistency with other vars
  • Loading branch information
Kliment Mamykin committed Apr 17, 2011
1 parent c9c5ab4 commit 4bcf0d1
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 5 deletions.
4 changes: 2 additions & 2 deletions README.md
Expand Up @@ -85,10 +85,10 @@ For this to work you need to make sure you have the CloudFront enabled via you A
To use CloudFront, simply add the following settings to config/assets.yml:

use_cloudfront: on
cloud_dist_id: XXXXXXXXXXXXXX
cloudfront_dist_id: XXXXXXXXXXXXXX
cloudfront_domain: xyzxyxyz.cloudfront.net

Please note that cloud_dist_id is not the same as the CloudFront domain
Please note that cloudfront_dist_id is not the same as the CloudFront domain
name. Inside CloudFront management console select the
distribution, and you will see Distribution ID and Domain Name values.

Expand Down
6 changes: 3 additions & 3 deletions lib/jammit/s3_uploader.rb
Expand Up @@ -21,7 +21,7 @@ def initialize(options = {})
@bucket = find_or_create_bucket
if Jammit.configuration[:use_cloudfront]
@changed_files = []
@cloud_dist_id = options[:cloud_dist_id] || Jammit.configuration[:cloud_dist_id]
@cloudfront_dist_id = options[:cloudfront_dist_id] || Jammit.configuration[:cloudfront_dist_id]
end
end
end
Expand Down Expand Up @@ -127,14 +127,14 @@ def invalidate_cache(files)
end
digest = HMAC::SHA1.new(@secret_access_key)
digest << date = Time.now.utc.strftime("%a, %d %b %Y %H:%M:%S %Z")
uri = URI.parse("https://cloudfront.amazonaws.com/2010-11-01/distribution/#{@cloud_dist_id}/invalidation")
uri = URI.parse("https://cloudfront.amazonaws.com/2010-11-01/distribution/#{@cloudfront_dist_id}/invalidation")
req = Net::HTTP::Post.new(uri.path)
req.initialize_http_header({
'x-amz-date' => date,
'Content-Type' => 'text/xml',
'Authorization' => "AWS %s:%s" % [@access_key_id, Base64.encode64(digest.digest).gsub("\n", '')]
})
req.body = "<InvalidationBatch>#{paths}<CallerReference>#{@cloud_dist_id}_#{Time.now.utc.to_i}</CallerReference></InvalidationBatch>"
req.body = "<InvalidationBatch>#{paths}<CallerReference>#{@cloudfront_dist_id}_#{Time.now.utc.to_i}</CallerReference></InvalidationBatch>"
http = Net::HTTP.new(uri.host, uri.port)
http.use_ssl = true
http.verify_mode = OpenSSL::SSL::VERIFY_NONE
Expand Down

0 comments on commit 4bcf0d1

Please sign in to comment.