lib/exvo_helpers/helpers.rb in exvo_helpers-0.4.0 vs lib/exvo_helpers/helpers.rb in exvo_helpers-0.5.0

- old
+ new

@@ -103,19 +103,74 @@ # @@auth_client_id = auth_client_id # end define_method "auth_#{option}=" do |value| class_variable_set("@@auth_#{option}", value) end + end end + # SSO Cookie Domain + + # Dynamically define class methods + class << self + + %w(sso_cookie_domain).each do |option| + + # def self.sso_cookie_domain + # @@sso_cookie_domain ||= ENV['SSO_COOKIE_DOMAIN'] || default_opts[env.to_sym][:sso_cookie_domain] + # end + define_method "#{option}" do + if class_variable_defined?("@@#{option}") and class_variable_get("@@#{option}") + class_variable_get("@@#{option}") + else + domain = ENV["#{option.upcase}"] || default_opts[env.to_sym]["#{option}".to_sym] + class_variable_set("@@#{option}", domain) + end + end + + # def self.sso_cookie_domain=(domain) + # @@sso_cookie_domain = domain + # end + define_method "#{option}=" do |value| + class_variable_set("@@#{option}", value) + end + + end + + %w(sso_cookie_secret).each do |option| + + # def self.sso_cookie_secret + # @@sso_cookie_secret ||= ENV['SSO_COOKIE_secret'] + # end + define_method "#{option}" do + if class_variable_defined?("@@#{option}") and class_variable_get("@@#{option}") + class_variable_get("@@#{option}") + else + secret = ENV["#{option.upcase}"] + class_variable_set("@@#{option}", secret) + end + end + + # def self.sso_cookie_secret=(secret) + # @@sso_cookie_secret = secret + # end + define_method "#{option}=" do |value| + class_variable_set("@@#{option}", value) + end + + end + + end + + # ENV # by default fall back to production; this way the omniauth-exvo's gem specs can pass - # (they depend on this gem and on env, but nor Rails nor Merb is undefined there) + # (they depend on this gem and on env, but nor Rails nor Merb is defined there) def self.env @@env ||= Rails.env if defined?(Rails) @@env ||= Merb.env if defined?(Merb) @@env ||= ENV["RACK_ENV"] if ENV["RACK_ENV"] @@env ||= 'production' @@ -132,10 +187,11 @@ { :production => { :auth_debug => false, :auth_host => 'auth.exvo.com', :auth_require_ssl => true, + :sso_cookie_domain => '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', @@ -145,27 +201,29 @@ :pics_host => 'pics.exvo.com', :preview_host => 'preview.exvo.com' }, :staging => { :auth_debug => false, - :auth_host => 'staging.auth.exvo.com', + :auth_host => 'auth.exvo.co', :auth_require_ssl => false, + :sso_cookie_domain => 'exvo.co', :cdn_host => 'd1by559a994699.cloudfront.net', - :cfs_host => 'staging.cfs.exvo.com', + :cfs_host => 'cfs.exvo.co', :desktop_host => 'www.exvo.co', - :themes_host => 'staging.themes.exvo.com', - :blog_host => 'staging.blog.exvo.com', - :contacts_host => 'staging.contacts.exvo.com', - :inbox_host => 'staging.inbox.exvo.com', - :music_host => 'staging.music.exvo.com', - :pics_host => 'staging.pics.exvo.com', - :preview_host => 'staging.preview.exvo.com' + :themes_host => 'themes.exvo.co', + :blog_host => 'blog.exvo.co', + :contacts_host => 'contacts.exvo.co', + :inbox_host => 'inbox.exvo.co', + :music_host => 'music.exvo.co', + :pics_host => 'pics.exvo.co', + :preview_host => 'preview.exvo.co' }, :development => { :auth_debug => false, :auth_host => 'auth.exvo.local', :auth_require_ssl => false, + :sso_cookie_domain => 'exvo.local', :cdn_host => 'www.exvo.local', :cfs_host => 'cfs.exvo.local', :desktop_host => 'www.exvo.local', :themes_host => 'themes.exvo.local', :blog_host => 'blog.exvo.local', @@ -177,9 +235,10 @@ }, :test => { :auth_debug => false, :auth_host => 'auth.exvo.local', :auth_require_ssl => false, + :sso_cookie_domain => 'exvo.local', :cdn_host => 'www.exvo.local', :cfs_host => 'cfs.exvo.local', :desktop_host => 'www.exvo.local', :themes_host => 'themes.exvo.local', :blog_host => 'blog.exvo.local',