Skip to content

Commit

Permalink
Handle parentheses in variables in commands
Browse files Browse the repository at this point in the history
  • Loading branch information
i7an committed Jan 8, 2025
1 parent 1547089 commit 7627f74
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion lib/kamal/secrets/dotenv/inline_command_substitution.rb
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ def install!
::Dotenv::Parser.substitutions.map! { |sub| sub == ::Dotenv::Substitutions::Command ? self : sub }
end

def call(value, _env, overwrite: false)
def call(value, env, overwrite: false)
# Process interpolated shell commands
value.gsub(Dotenv::Substitutions::Command.singleton_class::INTERPOLATED_SHELL_COMMAND) do |*|
# Eliminate opening and closing parentheses
Expand All @@ -14,6 +14,7 @@ def call(value, _env, overwrite: false)
# Command is escaped, don't replace it.
$LAST_MATCH_INFO[0][1..]
else
command = ::Dotenv::Substitutions::Variable.call(command, env)
if command =~ /\A\s*kamal\s*secrets\s+/
# Inline the command
inline_secrets_command(command)
Expand Down

0 comments on commit 7627f74

Please sign in to comment.