Skip to content

Commit

Permalink
Updated accessory proxy to support hosts option
Browse files Browse the repository at this point in the history
  • Loading branch information
igor-alexandrov committed Oct 9, 2024
1 parent c17bf6c commit 2b4cb8f
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 3 deletions.
7 changes: 6 additions & 1 deletion lib/kamal/configuration/docs/accessory.yml
Original file line number Diff line number Diff line change
Expand Up @@ -94,14 +94,19 @@ accessories:
# Proxy
#
proxy:
# Host
# 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 deployed on that server that do have a host set.
#
# Specify one of `host` or `hosts`.
host: foo.example.com
hosts:
- foo.example.com
- bar.example.com

# App port
#
Expand Down
2 changes: 1 addition & 1 deletion test/commands/accessory_test.rb
Original file line number Diff line number Diff line change
Expand Up @@ -163,7 +163,7 @@ class CommandsAccessoryTest < ActiveSupport::TestCase

test "deploy" do
assert_equal \
"docker exec kamal-proxy kamal-proxy deploy custom-busybox --target \"172.1.0.2:80\" --host \"busybox.example.com\" --deploy-timeout \"30s\" --drain-timeout \"30s\" --buffer-requests --buffer-responses --log-request-header \"Cache-Control\" --log-request-header \"Last-Modified\" --log-request-header \"User-Agent\"",
"docker exec kamal-proxy kamal-proxy deploy custom-busybox --target=\"172.1.0.2:80\" --host=\"busybox.example.com\" --deploy-timeout=\"30s\" --drain-timeout=\"30s\" --buffer-requests --buffer-responses --log-request-header=\"Cache-Control\" --log-request-header=\"Last-Modified\" --log-request-header=\"User-Agent\"",
new_command(:busybox).deploy(target: "172.1.0.2").join(" ")
end

Expand Down
2 changes: 1 addition & 1 deletion test/configuration/accessory_test.rb
Original file line number Diff line number Diff line change
Expand Up @@ -158,6 +158,6 @@ class ConfigurationAccessoryTest < ActiveSupport::TestCase

test "proxy" do
assert @config.accessory(:monitoring).running_proxy?
assert_equal "monitoring.example.com", @config.accessory(:monitoring).proxy.host
assert_equal [ "monitoring.example.com" ], @config.accessory(:monitoring).proxy.hosts
end
end

0 comments on commit 2b4cb8f

Please sign in to comment.