Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
Merge pull request #210 from gabceb/kandan-209
Fixed faye host bug for production
  • Loading branch information
fusion94 committed Mar 13, 2013
2 parents 6c2b3fe + ae6b41a commit 8b49252
Show file tree
Hide file tree
Showing 4 changed files with 6 additions and 9 deletions.
@@ -1,11 +1,7 @@
class Kandan.Broadcasters.FayeBroadcaster

constructor: ()->
@fayeClient = new Faye.Client("http://<%= ActionMailer::Base.default_url_options[:host] %>/remote/faye")

<% if Rails.env == "test" %>
@fayeClient.setHeader('Access-Control-Allow-Origin', '*');
<% end %>
@fayeClient = new Faye.Client("<%= ENV['FULL_HOST'] %>/remote/faye")

@fayeClient.disable('websocket')
authExtension = {
Expand Down
3 changes: 1 addition & 2 deletions config/environments/development.rb
Expand Up @@ -39,6 +39,5 @@
config.logger.level = Logger.const_get(
ENV['LOG_LEVEL'] ? ENV['LOG_LEVEL'].upcase : 'DEBUG'
)

config.action_mailer.default_url_options = { :host => "localhost:3000" }

end
4 changes: 3 additions & 1 deletion config/environments/test.rb
Expand Up @@ -35,5 +35,7 @@
# Print deprecation notices to the stderr
config.active_support.deprecation = :stderr

config.action_mailer.default_url_options = { :host => "localhost:9292" }
# Variable set to be able to get faye client for test environments
ENV['FULL_HOST'] = "http://localhost:9292"

end
2 changes: 1 addition & 1 deletion lib/broadcasters/faye.rb
Expand Up @@ -13,7 +13,7 @@ def broadcast(channel, message)
end

def assets
["http://#{ActionMailer::Base.default_url_options[:host]}/remote/faye.js"]
["#{ENV['FULL_HOST']}/remote/faye.js"]
end
end
end
Expand Down

0 comments on commit 8b49252

Please sign in to comment.