Make the secrets commands inline aware
Rather than redirecting the global $stdout, which is not never clever in a threaded program, we'll make the secrets commands aware they are being inlined, so they return the value instead of printing it. Additionally we no longer need to interrupt the parent process on error as we've inlined the command - exit 1 is enough.
This commit is contained in:
@@ -30,17 +30,9 @@ class Kamal::Secrets
|
||||
|
||||
def parse_secrets
|
||||
if secrets_file
|
||||
interrupting_parent_on_error { ::Dotenv.parse(secrets_file) }
|
||||
::Dotenv.parse(secrets_file)
|
||||
else
|
||||
{}
|
||||
end
|
||||
end
|
||||
|
||||
def interrupting_parent_on_error
|
||||
# Make any `kamal secrets` calls in dotenv interpolation interrupt this process if there are errors
|
||||
ENV["KAMAL_SECRETS_INT_PARENT"] = "1"
|
||||
yield
|
||||
ensure
|
||||
ENV.delete("KAMAL_SECRETS_INT_PARENT")
|
||||
end
|
||||
end
|
||||
|
||||
Reference in New Issue
Block a user