Handle parentheses in variables in commands
This commit is contained in:
@@ -4,7 +4,7 @@ class Kamal::Secrets::Dotenv::InlineCommandSubstitution
|
|||||||
::Dotenv::Parser.substitutions.map! { |sub| sub == ::Dotenv::Substitutions::Command ? self : sub }
|
::Dotenv::Parser.substitutions.map! { |sub| sub == ::Dotenv::Substitutions::Command ? self : sub }
|
||||||
end
|
end
|
||||||
|
|
||||||
def call(value, _env, overwrite: false)
|
def call(value, env, overwrite: false)
|
||||||
# Process interpolated shell commands
|
# Process interpolated shell commands
|
||||||
value.gsub(Dotenv::Substitutions::Command.singleton_class::INTERPOLATED_SHELL_COMMAND) do |*|
|
value.gsub(Dotenv::Substitutions::Command.singleton_class::INTERPOLATED_SHELL_COMMAND) do |*|
|
||||||
# Eliminate opening and closing parentheses
|
# Eliminate opening and closing parentheses
|
||||||
@@ -14,6 +14,7 @@ class Kamal::Secrets::Dotenv::InlineCommandSubstitution
|
|||||||
# Command is escaped, don't replace it.
|
# Command is escaped, don't replace it.
|
||||||
$LAST_MATCH_INFO[0][1..]
|
$LAST_MATCH_INFO[0][1..]
|
||||||
else
|
else
|
||||||
|
command = ::Dotenv::Substitutions::Variable.call(command, env)
|
||||||
if command =~ /\A\s*kamal\s*secrets\s+/
|
if command =~ /\A\s*kamal\s*secrets\s+/
|
||||||
# Inline the command
|
# Inline the command
|
||||||
inline_secrets_command(command)
|
inline_secrets_command(command)
|
||||||
|
|||||||
Reference in New Issue
Block a user