From 2b4cb8fe1df67a4c60ee383006bceb5b2f19e55f Mon Sep 17 00:00:00 2001 From: Igor Alexandrov Date: Wed, 9 Oct 2024 14:06:38 +0400 Subject: [PATCH] Updated accessory proxy to support hosts option --- lib/kamal/configuration/docs/accessory.yml | 7 ++++++- test/commands/accessory_test.rb | 2 +- test/configuration/accessory_test.rb | 2 +- 3 files changed, 8 insertions(+), 3 deletions(-) diff --git a/lib/kamal/configuration/docs/accessory.yml b/lib/kamal/configuration/docs/accessory.yml index 44aab078f..e81cf3919 100644 --- a/lib/kamal/configuration/docs/accessory.yml +++ b/lib/kamal/configuration/docs/accessory.yml @@ -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 # diff --git a/test/commands/accessory_test.rb b/test/commands/accessory_test.rb index 9062ad98b..68603203d 100644 --- a/test/commands/accessory_test.rb +++ b/test/commands/accessory_test.rb @@ -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 diff --git a/test/configuration/accessory_test.rb b/test/configuration/accessory_test.rb index adc78f170..0a9c452f9 100644 --- a/test/configuration/accessory_test.rb +++ b/test/configuration/accessory_test.rb @@ -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