Allow log max size to not be set

The max-size log opt is not valid for all logging drivers, such as
syslog. Allow the option to be removed from the boot config with:

```
kamal proxy boot_config set --log-max-size=
or
kamal proxy boot_config set --log-max-size=""
```
This commit is contained in:
Donal McBreen
2024-10-23 15:05:20 +01:00
parent 57d582e3bc
commit 9a8a45015b
3 changed files with 11 additions and 1 deletions

View File

@@ -37,6 +37,7 @@ class Kamal::Cli::Proxy < Kamal::Cli::Base
] ]
on(KAMAL.proxy_hosts) do |host| on(KAMAL.proxy_hosts) do |host|
p boot_options
execute(*KAMAL.proxy.ensure_proxy_directory) execute(*KAMAL.proxy.ensure_proxy_directory)
upload! StringIO.new(boot_options.join(" ")), KAMAL.config.proxy_options_file upload! StringIO.new(boot_options.join(" ")), KAMAL.config.proxy_options_file
end end

View File

@@ -254,7 +254,7 @@ class Kamal::Configuration
end end
def proxy_logging_args(max_size) def proxy_logging_args(max_size)
argumentize "--log-opt", "max-size=#{max_size}" argumentize "--log-opt", "max-size=#{max_size}" if max_size.present?
end end
def proxy_options_default def proxy_options_default

View File

@@ -263,6 +263,15 @@ class CliProxyTest < CliTestCase
end end
end end
test "boot_config set no log max size" do
run_command("boot_config", "set", "--log-max-size=").tap do |output|
%w[ 1.1.1.1 1.1.1.2 ].each do |host|
assert_match "Running /usr/bin/env mkdir -p .kamal/proxy on #{host}", output
assert_match "Uploading \"--publish 80:80 --publish 443:443\" to .kamal/proxy/options on #{host}", output
end
end
end
test "boot_config set custom ports" do test "boot_config set custom ports" do
run_command("boot_config", "set", "--http-port", "8080", "--https-port", "8443").tap do |output| run_command("boot_config", "set", "--http-port", "8080", "--https-port", "8443").tap do |output|
%w[ 1.1.1.1 1.1.1.2 ].each do |host| %w[ 1.1.1.1 1.1.1.2 ].each do |host|