lib/exvo_helpers/helpers.rb in exvo_helpers-0.0.7 vs lib/exvo_helpers/helpers.rb in exvo_helpers-0.0.8
- old
+ new
@@ -6,14 +6,18 @@
class << self
%w(cdn cfs desktop themes blog contacts inbox music pics preview).each do |service|
# def self.cdn_uri
- # "http://#{cdn_host}"
+ # protocol = ["cdn", "cfs", "themes"].include?(service) && env.to_sym == :production ? "//" : "http://"
+ # protocol + cdn_host
# end
define_method "#{service}_uri" do
- "http://#{ send("#{service}_host") }"
+ # special link starting with '//' in production so that the webserver can choose between HTTP and HTTPS
+ # but only for those apps/services that have proper SSL support (i.e. valid certificates)
+ protocol = ["cdn", "cfs", "themes"].include?(service) && env.to_sym == :production ? "//" : "http://"
+ protocol + send("#{service}_host")
end
# def self.cdn_host
# @@cdn_host ||= ENV['CDN_HOST'] || default_opts[env.to_sym][:cdn_host]
# end
@@ -75,11 +79,11 @@
private
def self.default_opts
{
:production => {
- :cdn_host => 'cdn.exvo.com',
+ :cdn_host => 'd33gjlr95u9pgf.cloudfront.net', # cloudfront.net so we can use https (cdn.exvo.com via https does not work properly)
:cfs_host => 'cfs.exvo.com',
:desktop_host => 'www.exvo.com',
:themes_host => 'themes.exvo.com',
:blog_host => 'blog.exvo.com',
:contacts_host => 'contacts.exvo.com',
@@ -87,10 +91,10 @@
:music_host => 'music.exvo.com',
:pics_host => 'pics.exvo.com',
:preview_host => 'preview.exvo.com'
},
:staging => {
- :cdn_host => 'staging.cdn.exvo.com',
+ :cdn_host => 'd1by559a994699.cloudfront.net',
:cfs_host => 'staging.cfs.exvo.com',
:desktop_host => 'www.exvo.co',
:themes_host => 'staging.themes.exvo.com',
:blog_host => 'staging.blog.exvo.com',
:contacts_host => 'exvo-contacts-staging.heroku.com',