Add the proxy/ssl config and pass on to kamal-proxy
This commit is contained in:
@@ -56,6 +56,13 @@ proxy:
|
||||
# requests for other apps that do have a host set.
|
||||
host: foo.example.com
|
||||
|
||||
# SSL
|
||||
#
|
||||
# Kamal Proxy can automatically obtain and renew TLS certificates for your applications.
|
||||
# To ensure this set, the ssl flag. This only works if we are deploying to one server and
|
||||
# the host flag is set.
|
||||
ssl: true
|
||||
|
||||
# Deploy timeout
|
||||
#
|
||||
# How long to wait for the app to boot when deploying, defaults to 30 seconds
|
||||
|
||||
@@ -10,7 +10,7 @@ class Kamal::Configuration::Proxy
|
||||
|
||||
def initialize(config:)
|
||||
@proxy_config = config.raw_config.proxy || {}
|
||||
validate! proxy_config
|
||||
validate! proxy_config, with: Kamal::Configuration::Validator::Proxy
|
||||
end
|
||||
|
||||
def enabled?
|
||||
@@ -37,9 +37,14 @@ class Kamal::Configuration::Proxy
|
||||
argumentize "--publish", [ "#{DEFAULT_HTTP_PORT}:#{DEFAULT_HTTP_PORT}", "#{DEFAULT_HTTPS_PORT}:#{DEFAULT_HTTPS_PORT}" ]
|
||||
end
|
||||
|
||||
def ssl?
|
||||
proxy_config.fetch("ssl", false)
|
||||
end
|
||||
|
||||
def deploy_options
|
||||
{
|
||||
host: proxy_config["host"],
|
||||
tls: proxy_config["ssl"],
|
||||
"deploy-timeout": proxy_config["deploy_timeout"],
|
||||
"drain-timeout": proxy_config["drain_timeout"],
|
||||
"health-check-interval": proxy_config.dig("health_check", "interval"),
|
||||
|
||||
9
lib/kamal/configuration/validator/proxy.rb
Normal file
9
lib/kamal/configuration/validator/proxy.rb
Normal file
@@ -0,0 +1,9 @@
|
||||
class Kamal::Configuration::Validator::Proxy < Kamal::Configuration::Validator
|
||||
def validate!
|
||||
super
|
||||
|
||||
if config["host"].blank? && config["ssl"]
|
||||
error "Must set a host to enable automatic SSL"
|
||||
end
|
||||
end
|
||||
end
|
||||
Reference in New Issue
Block a user