Merge pull request #1045 from junket/allow-false-env-var-value

Allow false env var value
This commit is contained in:
Donal McBreen
2024-10-23 11:11:43 +01:00
committed by GitHub
2 changed files with 4 additions and 2 deletions

View File

@@ -12,6 +12,8 @@ module Kamal::Utils
attr = "#{key}=#{escape_shell_value(value)}" attr = "#{key}=#{escape_shell_value(value)}"
attr = self.sensitive(attr, redaction: "#{key}=[REDACTED]") if sensitive attr = self.sensitive(attr, redaction: "#{key}=[REDACTED]") if sensitive
[ argument, attr ] [ argument, attr ]
elsif value == false
[ argument, "#{key}=false" ]
else else
[ argument, key ] [ argument, key ]
end end

View File

@@ -2,8 +2,8 @@ require "test_helper"
class UtilsTest < ActiveSupport::TestCase class UtilsTest < ActiveSupport::TestCase
test "argumentize" do test "argumentize" do
assert_equal [ "--label", "foo=\"\\`bar\\`\"", "--label", "baz=\"qux\"", "--label", :quux ], \ assert_equal [ "--label", "foo=\"\\`bar\\`\"", "--label", "baz=\"qux\"", "--label", :quux, "--label", "quuz=false" ], \
Kamal::Utils.argumentize("--label", { foo: "`bar`", baz: "qux", quux: nil }) Kamal::Utils.argumentize("--label", { foo: "`bar`", baz: "qux", quux: nil, quuz: false })
end end
test "argumentize with redacted" do test "argumentize with redacted" do