tristandunn / pusher-fake

A fake Pusher server for development and testing.
https://rubygems.org/gems/pusher-fake
MIT License
173 stars 32 forks source link

add example of SSL in readme.md #73

Closed jtwaleson closed 2 years ago

jtwaleson commented 2 years ago

The documentation on SSL/TLS was very light and the reasoning for not including the options in the binary was not explicitly explained. This fixes that.

tristandunn commented 2 years ago

Thanks for the pull request and sorry for the delay in getting back.

How do you feel about this change instead? I'd prefer to link to the existing file and documentation to avoid needed to update it in multiple places. And I skipped repeating that local usage is intended since since that's essentially the description of the library. If you're happy with that I'll adjust the commit to be yours and merge it.

jtwaleson commented 2 years ago

My 2 cents: I've managed to figure it out, but it took me about half an hour of debugging for the exact configuration options. E.g. ssl_options in the README should be tls_options. My preference is to include a snippet like I proposed but with a disclaimer like "This is just an example and works now, in July 2022, but note that the exact configuration might change if the underlying libraries change." I understand your point about maintainability and it's completely your decision, it's fine with me either way.

tristandunn commented 2 years ago

ssl_options in the README should be tls_options

Can you clarify which library that's for? em-websocket uses tls_options and thin uses ssl_options which the README mentions, but want to make sure that's not outdated.

jtwaleson commented 2 years ago

em-websocket I guess. But that example is exemplary of the confusion ;) It's probably not outdated, but I don't know how pusher-fake is using em-websocket or thin so I tried to copy paste the only thing I could find from the readme.

tristandunn commented 2 years ago

What do you think about adding comments to bin/pusher-fake as an example along with my README update? That'd let the README be somewhat vague about the external library options and limit the binary options to a rough example to get people started, but at least lead you in the right direction a bit more.

PusherFake.configure do |configuration|
  # ...

  # Optionally enable TLS for the em-websocket server.
  # configuration.socket_options = {
  #   secure: true,
  #   tls_options: { }
  # }
  #
  # Optionally enable SSL for the Thin web server.
  # configuration.web_options = {
  #   ssl: true,
  #   ssl_options: { }
  # }
end
tristandunn commented 2 years ago

Closing in favor of #76.