Skip to content

Commit

Permalink
change pusher api key for staging #9
Browse files Browse the repository at this point in the history
  • Loading branch information
kysnm committed Apr 17, 2012
1 parent efcea18 commit f920efb
Show file tree
Hide file tree
Showing 3 changed files with 11 additions and 3 deletions.
2 changes: 0 additions & 2 deletions README.rdoc
Original file line number Diff line number Diff line change
Expand Up @@ -21,8 +21,6 @@
PUSHER_KEY=xxxx
PUSHER_SECRET=xxxx
PATH=bin:vendor/bundle/ruby/1.9.1/bin:/usr/local/bin:/usr/bin:/bin
PUSHER_SOCKET_URL=xxxx
PUSHER_URL=xxxx
RACK_ENV=staging|production
RUBY_VERSION=ruby-1.9.3-p125

Expand Down
10 changes: 10 additions & 0 deletions app.rb
Original file line number Diff line number Diff line change
Expand Up @@ -31,4 +31,14 @@
erb :not_found
end

helpers do
def pusher_api_key
if ENV["RACK_ENV"] == "development"
ENV["PUSHER_KEY"]
else
URI.parse(ENV["PUSHER_URL"]).user
end
end
end

use Rack::Static, :urls => ["/images"], :root => "public"
2 changes: 1 addition & 1 deletion views/layout.erb
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@
</script>
<script>
$(window).ready(function() {
var pusher = new Pusher('<%= ENV["PUSHER_KEY"] %>');
var pusher = new Pusher('<%= pusher_api_key %>');
var channel = pusher.subscribe('tweets');

channel.bind('tweet', function(tweet) {
Expand Down

0 comments on commit f920efb

Please sign in to comment.