Read cluster from default client
Opened this issue · 4 comments
In my initializer I have
Pusher.app_id = ENV['PUSHER_AP_ID']
Pusher.key = ENV['PUSHER_KEY']
:
Pusher.cluster = ENV['PUSHER_CLUSTER']
and then later, I need to access the values Pusher.key
, Pusher.cluster
to pass the front-end. The key
is fine, but cluster
gives a no-method error. I could access the environment again of course, but that seems inelegant. Is there some deep reason why :cluster
is an attr_writer
rather than an attr_accessor
? If not, could I request that it becomes one?
Thanks!
Hi there!
Sorry for the late response. I seem to have missed this issue on my list of notifications.
It certainly could be an accessor too. I'll add it in along with some other changes (if any) in the next release.
Thanks!
FYI, the main reason is that cluster
is not an attribute, it is a convenience method which sets the host
attribute according to our convention for endpoint naming (i.e. api-${cluster}.pusher.com
). The canonical attribute is host
, because people may want to target an endpoint that does not follow our naming convention (e.g. a mock server of their own during testing).
That said, I'm sure we can sort something out.
Thank you! BTW, I'm finding that integrating Pusher into my application removes a load of complexity and reduces server load significantly, most impressed, great service.
Thanks for the fix!