Skip to content
Permalink

Comparing changes

This is a direct comparison between two commits made in this repository or its related repositories. View the default comparison for this range or learn more about diff comparisons.

Open a pull request

Create a new pull request by comparing changes across two branches. If you need to, you can also . Learn more about diff comparisons here.
base repository: basecamp/kamal
Failed to load repositories. Confirm that selected base ref is valid, then try again.
Loading
base: b3a6a0e557d9806e7b49890c1bede2532d678992
Choose a base ref
..
head repository: basecamp/kamal
Failed to load repositories. Confirm that selected head ref is valid, then try again.
Loading
compare: b33ffa6d0e1b4cfaed76ebe36ab810f18e2eef2a
Choose a head ref
Showing with 5 additions and 4 deletions.
  1. +5 −4 lib/kamal/secrets.rb
9 changes: 5 additions & 4 deletions lib/kamal/secrets.rb
Original file line number Diff line number Diff line change
@@ -14,7 +14,7 @@ def [](key)
secrets.fetch(key)
end

missing_key_warning(key) unless value.present?
blank_key_warning(key) unless value.present?

value
rescue KeyError
@@ -34,8 +34,8 @@ def secrets_files
end

private
def missing_key_warning(key)
warn "Warning: Kamal secret #{key} has no value, did you forget to set it?"
def blank_key_warning(key)
warn "Warning: Kamal secret #{key} is blank."
secrets_files.each do |secrets_file|
next unless File.exist?(secrets_file)

@@ -44,7 +44,8 @@ def missing_key_warning(key)

warn "Tip: see #{secrets_file}:#{line_num + 1}: #{line.strip}"
if line.match?(/^\s*#{key}=\$\w+/)
warn "Tip: the environment variable #{key} is #{ENV[key].nil? ? "not set" : "blank"}."
warn "Tip: the environment variable #{key} is #{ENV[key].nil? ?
"not set" : "blank"}. Did you forget to set it?"
elsif (matches = line.match(/^\s*#{key}=\$\(([^)]+)\)/)).present?
warn "Tip: the shell command \`#{matches[1]}\` returned an empty value."
end