Skip to content

Commit

Permalink
README.md - clarify use of localhost gem
Browse files Browse the repository at this point in the history
  • Loading branch information
MSP-Greg committed Jun 30, 2023
1 parent 7c85305 commit 55e4c0b
Showing 1 changed file with 10 additions and 7 deletions.
17 changes: 10 additions & 7 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -211,29 +211,32 @@ Puma supports the [`localhost`] gem for self-signed certificates. This is partic

Puma automatically configures SSL when the [`localhost`] gem is loaded in a `development` environment:

Add the gem to your Gemfile:
```ruby
# Add the gem to your Gemfile
group(:development) do
gem 'localhost'
end
```

# And require it implicitly using bundler
And require it implicitly using bundler:
```ruby
require "bundler"
Bundler.require(:default, ENV["RACK_ENV"].to_sym)
```

# Alternatively, you can require the gem in config.ru:
require './app'
Alternatively, you can require the gem in your configuration file, either `config/puma/development.rb`, `config/puma.rb`, or set via the `-C` cli option:
```ruby
require 'localhost'
run Sinatra::Application
# configuration methods (from Puma::DSL) as needed
```

Additionally, Puma must be listening to an SSL socket:

```shell
$ puma -b 'ssl://localhost:9292' config.ru
$ puma -b 'ssl://localhost:9292' -C config/use_local_host.rb

# The following options allow you to reach Puma over HTTP as well:
$ puma -b ssl://localhost:9292 -b tcp://localhost:9393 config.ru
$ puma -b ssl://localhost:9292 -b tcp://localhost:9393 -C config/use_local_host.rb
```

[`localhost`]: https://github.com/socketry/localhost
Expand Down

0 comments on commit 55e4c0b

Please sign in to comment.