From b3a692111801ea87add3919396dbae9328632d34 Mon Sep 17 00:00:00 2001 From: Donal McBreen Date: Thu, 26 Sep 2024 06:17:40 -0400 Subject: [PATCH] Handle ssl: false in proxy config Fixes: https://github.com/basecamp/kamal/issues/956 --- lib/kamal/configuration/proxy.rb | 2 +- test/configuration/proxy_test.rb | 8 +++++++- 2 files changed, 8 insertions(+), 2 deletions(-) diff --git a/lib/kamal/configuration/proxy.rb b/lib/kamal/configuration/proxy.rb index af09e2c7c..c8fbbb6ae 100644 --- a/lib/kamal/configuration/proxy.rb +++ b/lib/kamal/configuration/proxy.rb @@ -29,7 +29,7 @@ def host def deploy_options { host: proxy_config["host"], - tls: proxy_config["ssl"], + tls: proxy_config["ssl"] ? true : nil, "deploy-timeout": seconds_duration(config.deploy_timeout), "drain-timeout": seconds_duration(config.drain_timeout), "health-check-interval": seconds_duration(proxy_config.dig("healthcheck", "interval")), diff --git a/test/configuration/proxy_test.rb b/test/configuration/proxy_test.rb index 3aa3f85e3..891bf6b89 100644 --- a/test/configuration/proxy_test.rb +++ b/test/configuration/proxy_test.rb @@ -1,6 +1,6 @@ require "test_helper" -class ConfigurationEnvTest < ActiveSupport::TestCase +class ConfigurationProxyTest < ActiveSupport::TestCase setup do @deploy = { service: "app", image: "dhh/app", registry: { "username" => "dhh", "password" => "secret" }, @@ -18,6 +18,12 @@ class ConfigurationEnvTest < ActiveSupport::TestCase assert_raises(Kamal::ConfigurationError) { config.proxy.ssl? } end + test "ssl false" do + @deploy[:proxy] = { "ssl" => false } + assert_not config.proxy.ssl? + assert_not config.proxy.deploy_options.has_key?(:tls) + end + private def config Kamal::Configuration.new(@deploy)