Skip to content

Commit

Permalink
Switch proxy/hosts to proxy/host
Browse files Browse the repository at this point in the history
The proxy only supports a single host per app for nowm so make the
config match that.
  • Loading branch information
djmb committed Sep 16, 2024
1 parent 1f72173 commit 267b526
Show file tree
Hide file tree
Showing 4 changed files with 7 additions and 9 deletions.
10 changes: 4 additions & 6 deletions lib/kamal/configuration/docs/proxy.yml
Original file line number Diff line number Diff line change
Expand Up @@ -7,16 +7,14 @@
# run on the same proxy.
proxy:

# Hosts
# Host
#
# These are the hosts that will be used to serve the app. If you deploy more
# than one application to a single host, the proxy will route requests based
# these hosts
# The hosts that will be used to serve the app. The proxy will only route requests
# to this host to your app.
#
# If no hosts are set, then all requests will be forwarded, except for matching
# requests for other apps that do have a host set.
hosts:
- foo.example.com
host: foo.example.com

# App port
#
Expand Down
2 changes: 1 addition & 1 deletion lib/kamal/configuration/proxy.rb
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ def ssl?

def deploy_options
{
host: proxy_config.fetch("hosts", []).first,
host: proxy_config["host"],
tls: proxy_config["ssl"],
"deploy-timeout": proxy_config["deploy_timeout"],
"drain-timeout": proxy_config["drain_timeout"],
Expand Down
2 changes: 1 addition & 1 deletion lib/kamal/configuration/validator/proxy.rb
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ class Kamal::Configuration::Validator::Proxy < Kamal::Configuration::Validator
def validate!
super

if config["hosts"].blank? && config["ssl"]
if config["host"].blank? && config["ssl"]
error "Must set a host to enable automatic SSL"
end
end
Expand Down
2 changes: 1 addition & 1 deletion test/configuration/proxy_test.rb
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ class ConfigurationEnvTest < ActiveSupport::TestCase
end

test "ssl with host" do
@deploy[:proxy] = { "ssl" => true, "hosts" => [ "example.com" ] }
@deploy[:proxy] = { "ssl" => true, "host" => "example.com" }
assert_equal true, config.proxy.ssl?
end

Expand Down

0 comments on commit 267b526

Please sign in to comment.