Skip to content
This repository has been archived by the owner on Apr 17, 2023. It is now read-only.

Commit

Permalink
config: allow puma to use TLS
Browse files Browse the repository at this point in the history
  • Loading branch information
mssola committed Feb 20, 2017
1 parent 4c97401 commit 2488791
Showing 1 changed file with 17 additions and 3 deletions.
20 changes: 17 additions & 3 deletions config/puma.rb
Original file line number Diff line number Diff line change
Expand Up @@ -4,10 +4,24 @@
threads 1, ENV["PORTUS_PUMA_MAX_THREADS"] || 1
workers ENV["PORTUS_PUMA_WORKERS"] || 1

# If specified, use the given host:port. Otherwise, we will use a local
# deployment through a UNIX socket.
# We can bind in three different ways:
#
# 1. TCP and SSL. For this, you have to specify the host and the path to the
# certificates. This is the preferred setup for production environments.
# 2. TCP with no SSL. For this, simply specify the host. Good for development
# purposes inside of a container.
# 3. UNIX socket. This is the default and it's good for development purposes if
# you are not using a container setup.
if ENV["PORTUS_PUMA_HOST"]
bind "tcp://#{ENV["PORTUS_PUMA_HOST"]}"
if ENV["PORTUS_PUMA_TLS_KEY"]
host, port = ENV["PORTUS_PUMA_HOST"].split(":")
port ||= "3000"
ssl_bind host, port,
key: ENV["PORTUS_PUMA_TLS_KEY"],
cert: ENV["PORTUS_PUMA_TLS_CERT"]
else
bind "tcp://#{ENV["PORTUS_PUMA_HOST"]}"
end
else
bind "unix://#{File.join(Dir.pwd, "tmp/sockets/puma.sock")}"
end
Expand Down

0 comments on commit 2488791

Please sign in to comment.