Skip to content

Commit

Permalink
Merge pull request #458 from basecamp/avoid-env-empty-file-warning
Browse files Browse the repository at this point in the history
Fix empty file warning when uploading env files
  • Loading branch information
djmb authored Sep 12, 2023
2 parents 7b42daa + c651de1 commit 70a3c71
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 70a3c71

Please sign in to comment.