diff --git a/lib/kamal/utils.rb b/lib/kamal/utils.rb index 6ab1648b1..c61d4cf8a 100644 --- a/lib/kamal/utils.rb +++ b/lib/kamal/utils.rb @@ -33,7 +33,7 @@ def env_file_with_secrets(env) end.string # Ensure the file has some contents to avoid the SSHKIT empty file warning - env_file || "\n" + env_file.presence || "\n" end # Returns a list of shell-dashed option arguments. If the value is true, it's treated like a value-less option. diff --git a/test/utils_test.rb b/test/utils_test.rb index cef0a7fa2..3edfe8f5c 100644 --- a/test/utils_test.rb +++ b/test/utils_test.rb @@ -33,6 +33,10 @@ class UtilsTest < ActiveSupport::TestCase Kamal::Utils.env_file_with_secrets(env) end + test "env file empty" do + assert_equal "\n", Kamal::Utils.env_file_with_secrets({}) + end + test "env file secret" do ENV["PASSWORD"] = "hello" env = {