Updated accessory proxy to support hosts option

This commit is contained in:
Igor Alexandrov
2024-10-09 14:06:38 +04:00
parent 9204624752
commit f52826b2d6
3 changed files with 8 additions and 3 deletions

View File

@@ -101,14 +101,19 @@ accessories:
# Proxy # Proxy
# #
proxy: proxy:
# Host # Hosts
# #
# The hosts that will be used to serve the app. The proxy will only route requests # The hosts that will be used to serve the app. The proxy will only route requests
# to this host to your app. # to this host to your app.
# #
# If no hosts are set, then all requests will be forwarded, except for matching # 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. # requests for other apps deployed on that server that do have a host set.
#
# Specify one of `host` or `hosts`.
host: foo.example.com host: foo.example.com
hosts:
- foo.example.com
- bar.example.com
# App port # App port
# #

View File

@@ -171,7 +171,7 @@ class CommandsAccessoryTest < ActiveSupport::TestCase
test "deploy" do test "deploy" do
assert_equal \ 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(" ") new_command(:busybox).deploy(target: "172.1.0.2").join(" ")
end end

View File

@@ -167,6 +167,6 @@ class ConfigurationAccessoryTest < ActiveSupport::TestCase
test "proxy" do test "proxy" do
assert @config.accessory(:monitoring).running_proxy? 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
end end