Skip to content

Commit

Permalink
Simplified proxy hosts validation and documentation, similar to acces…
Browse files Browse the repository at this point in the history
…sory config
  • Loading branch information
kpumuk committed Sep 30, 2024
1 parent c63ec39 commit 67ad766
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 13 deletions.
14 changes: 3 additions & 11 deletions lib/kamal/configuration/docs/proxy.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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.
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.
# Specify one of `host` or `hosts`.
host: foo.example.com
hosts:
- foo.example.com
- bar.example.com
Expand Down
4 changes: 2 additions & 2 deletions lib/kamal/configuration/validator/proxy.rb
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,8 @@ def validate!
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
Expand Down

0 comments on commit 67ad766

Please sign in to comment.