Skip to content

Commit

Permalink
Update Pusher cluster
Browse files Browse the repository at this point in the history
  • Loading branch information
julianguyen committed Aug 2, 2020
1 parent 8f5f0e0 commit 47a0fce
Show file tree
Hide file tree
Showing 5 changed files with 8 additions and 1 deletion.
1 change: 1 addition & 0 deletions app/views/layouts/application.html.erb
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,7 @@
<link rel="preconnect" href=<%= pusher_url %>>
<%= javascript_include_tag pusher_url, async: true %>
<%= tag :meta, name: 'pusher-key', content: ENV['PUSHER_KEY'] %>
<%= tag :meta, name: 'pusher-cluster', content: ENV['PUSHER_CLUSTER'] %>
<% end %>
</head>

Expand Down
5 changes: 4 additions & 1 deletion client/app/utils/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -17,8 +17,11 @@ const getPusher = () => {
const metaPusherKey = Array.from(
window.document.getElementsByTagName('meta'),
).filter((item) => item.getAttribute('name') === 'pusher-key')[0];
const metaPusherCluster = Array.from(
window.document.getElementsByTagName('meta'),
).filter((item) => item.getAttribute('name') === 'pusher-cluster')[0];
return new window.Pusher(metaPusherKey.getAttribute('content'), {
cluster: 'us3',
cluster: metaPusherCluster.getAttribute('content'),
});
}
return null;
Expand Down
1 change: 1 addition & 0 deletions config/env/development.example.env
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@ GOOGLE_API_KEY=""
PUSHER_APP_ID=""
PUSHER_KEY=""
PUSHER_SECRET=""
PUSHER_CLUSTER=""

# SMTP
SMTP_ADDRESS="[email protected]"
Expand Down
1 change: 1 addition & 0 deletions config/env/test.example.env
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@ GOOGLE_API_KEY=""
PUSHER_APP_ID=""
PUSHER_KEY=""
PUSHER_SECRET=""
PUSHER_CLUSTER=""

# SMTP
SMTP_ADDRESS="[email protected]"
Expand Down
1 change: 1 addition & 0 deletions config/initializers/pusher.rb
Original file line number Diff line number Diff line change
Expand Up @@ -8,3 +8,4 @@
Pusher.secret = ENV['PUSHER_SECRET']
Pusher.logger = Rails.logger
Pusher.encrypted = true
Pusher.cluster = ENV['PUSHER_CLUSTER']

0 comments on commit 47a0fce

Please sign in to comment.