Simplified proxy hosts validation and documentation, similar to accessory config

This commit is contained in:
Dmytro Shteflyuk
2024-09-29 11:46:21 -04:00
parent c63ec39f07
commit 67ad7662ab
2 changed files with 5 additions and 13 deletions

View File

@@ -17,24 +17,16 @@
# `proxy: true` or providing a proxy configuration.
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
# If multiple hosts are needed, these can be specified by comma-separating the hosts.
host: foo.example.com,bar.example.com
# Hosts
#
# The hosts that will be used to serve the app. The proxy will only route requests
# to these hosts 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.
hosts:
- foo.example.com
- bar.example.com

View File

@@ -7,8 +7,8 @@ class Kamal::Configuration::Validator::Proxy < Kamal::Configuration::Validator
error "Must set a host to enable automatic SSL"
end
if config["host"].present? && config["hosts"].present?
error "Must use either 'host' or 'hosts', not both"
if (config.keys & [ "host", "hosts" ]).size > 1
error "Specify one of 'host' or 'hosts', not both"
end
end
end