From ae10c0b1b1c159341fcb2279134267d6fa180d86 Mon Sep 17 00:00:00 2001 From: Jim Gilliam Date: Fri, 4 Dec 2009 12:12:51 -0800 Subject: [PATCH] now pulls S3_BUCKET config from the environment, or the s3.yml file --- app/models/government.rb | 6 +++--- app/models/partner.rb | 2 +- app/models/user.rb | 2 +- config/environments/production.rb | 2 +- 4 files changed, 6 insertions(+), 6 deletions(-) diff --git a/app/models/government.rb b/app/models/government.rb index a79ebe35..1766da8c 100644 --- a/app/models/government.rb +++ b/app/models/government.rb @@ -18,7 +18,7 @@ class Government < ActiveRecord::Base has_attached_file :logo, :styles => { :icon_96 => "96x96#", :icon_140 => "140x140#", :icon_180 => "180x180#", :medium => "450x" }, :storage => :s3, :s3_credentials => S3_CONFIG, - :path => ":class/:attachment/:id/:style.:extension", :bucket => ENV['DOMAIN'] + :path => ":class/:attachment/:id/:style.:extension", :bucket => S3_CONFIG["bucket"] validates_attachment_size :logo, :less_than => 5.megabytes validates_attachment_content_type :logo, :content_type => ['image/jpeg', 'image/png', 'image/gif'] @@ -26,7 +26,7 @@ class Government < ActiveRecord::Base belongs_to :buddy_icon_old, :class_name => "Picture" has_attached_file :buddy_icon, :styles => { :icon_24 => "24x24#", :icon_48 => "48x48#", :icon_96 => "96x96#" }, :storage => :s3, :s3_credentials => S3_CONFIG, :default_url => "/images/buddy_:style.png", - :path => ":class/:attachment/:id/:style.:extension", :bucket => ENV['DOMAIN'] + :path => ":class/:attachment/:id/:style.:extension", :bucket => S3_CONFIG["bucket"] validates_attachment_size :buddy_icon, :less_than => 5.megabytes validates_attachment_content_type :buddy_icon, :content_type => ['image/jpeg', 'image/png', 'image/gif'] @@ -34,7 +34,7 @@ class Government < ActiveRecord::Base belongs_to :fav_icon_old, :class_name => "Picture" has_attached_file :fav_icon, :styles => { :icon_16 => "16x16#" }, :storage => :s3, :s3_credentials => S3_CONFIG, :default_url => "/favicon.png", - :path => ":class/:attachment/:id/:style.:extension", :bucket => ENV['DOMAIN'] + :path => ":class/:attachment/:id/:style.:extension", :bucket => S3_CONFIG["bucket"] validates_attachment_size :fav_icon, :less_than => 5.megabytes validates_attachment_content_type :fav_icon, :content_type => ['image/jpeg', 'image/png', 'image/gif'] diff --git a/app/models/partner.rb b/app/models/partner.rb index 45e9694c..b0ba3884 100644 --- a/app/models/partner.rb +++ b/app/models/partner.rb @@ -8,7 +8,7 @@ class Partner < ActiveRecord::Base has_attached_file :logo, :styles => { :icon_96 => "96x96#", :icon_140 => "140x140#", :icon_180 => "180x180#", :medium => "450x" }, :storage => :s3, :s3_credentials => S3_CONFIG, - :path => ":class/:attachment/:id/:style.:extension", :bucket => ENV['DOMAIN'] + :path => ":class/:attachment/:id/:style.:extension", :bucket => S3_CONFIG["bucket"] validates_attachment_size :logo, :less_than => 5.megabytes validates_attachment_content_type :logo, :content_type => ['image/jpeg', 'image/png', 'image/gif'] diff --git a/app/models/user.rb b/app/models/user.rb index 504a2d19..8bf0b0ae 100644 --- a/app/models/user.rb +++ b/app/models/user.rb @@ -46,7 +46,7 @@ class User < ActiveRecord::Base belongs_to :picture has_attached_file :buddy_icon, :styles => { :icon_24 => "24x24#", :icon_48 => "48x48#", :icon_96 => "96x96#" }, :storage => :s3, :s3_credentials => S3_CONFIG, :default_url => "/images/buddy_:style.png", - :path => ":class/:attachment/:id/:style.:extension", :bucket => ENV['DOMAIN'] + :path => ":class/:attachment/:id/:style.:extension", :bucket => S3_CONFIG["bucket"] validates_attachment_size :buddy_icon, :less_than => 5.megabytes validates_attachment_content_type :buddy_icon, :content_type => ['image/jpeg', 'image/png', 'image/gif'] diff --git a/config/environments/production.rb b/config/environments/production.rb index d3682403..c6e0e2ad 100644 --- a/config/environments/production.rb +++ b/config/environments/production.rb @@ -37,5 +37,5 @@ end if ENV['S3_ACCESS_KEY_ID'] - S3_CONFIG = { 'access_key_id' => ENV['S3_ACCESS_KEY_ID'], 'secret_access_key' => ENV['S3_SECRET_ACCESS_KEY'] } + S3_CONFIG = { 'access_key_id' => ENV['S3_ACCESS_KEY_ID'], 'secret_access_key' => ENV['S3_SECRET_ACCESS_KEY'], 'bucket' => ENV['S3_BUCKET'] } end \ No newline at end of file