Skip to content

Commit

Permalink
Fix empty file warning when uploading env files
Browse files Browse the repository at this point in the history
  • Loading branch information
djmb committed Sep 12, 2023
1 parent 9d49b3e commit c651de1
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 1 deletion.
2 changes: 1 addition & 1 deletion lib/kamal/utils.rb
Original file line number Diff line number Diff line change
Expand Up @@ -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.
Expand Down
4 changes: 4 additions & 0 deletions test/utils_test.rb
Original file line number Diff line number Diff line change
Expand Up @@ -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 = {
Expand Down

0 comments on commit c651de1

Please sign in to comment.