Merge pull request #458 from basecamp/avoid-env-empty-file-warning

Fix empty file warning when uploading env files
This commit is contained in:
Donal McBreen
2023-09-12 12:05:31 +01:00
committed by GitHub
2 changed files with 5 additions and 1 deletions

View File

@@ -33,7 +33,7 @@ module Kamal::Utils
end.string end.string
# Ensure the file has some contents to avoid the SSHKIT empty file warning # Ensure the file has some contents to avoid the SSHKIT empty file warning
env_file || "\n" env_file.presence || "\n"
end end
# Returns a list of shell-dashed option arguments. If the value is true, it's treated like a value-less option. # Returns a list of shell-dashed option arguments. If the value is true, it's treated like a value-less option.

View File

@@ -33,6 +33,10 @@ class UtilsTest < ActiveSupport::TestCase
Kamal::Utils.env_file_with_secrets(env) Kamal::Utils.env_file_with_secrets(env)
end end
test "env file empty" do
assert_equal "\n", Kamal::Utils.env_file_with_secrets({})
end
test "env file secret" do test "env file secret" do
ENV["PASSWORD"] = "hello" ENV["PASSWORD"] = "hello"
env = { env = {