Allow "clear" only env configuration

This commit is contained in:
Adam Miribyan
2023-01-28 17:19:07 +01:00
parent c23928348b
commit afefd32379
2 changed files with 9 additions and 1 deletions

View File

@@ -18,7 +18,7 @@ module Mrsk::Utils
if (secrets = env["secret"]).present? if (secrets = env["secret"]).present?
argumentize("-e", secrets.to_h { |key| [ key, ENV.fetch(key) ] }, redacted: true) + argumentize("-e", env["clear"]) argumentize("-e", secrets.to_h { |key| [ key, ENV.fetch(key) ] }, redacted: true) + argumentize("-e", env["clear"])
else else
argumentize "-e", env argumentize "-e", env.fetch("clear", env)
end end
end end

View File

@@ -105,6 +105,14 @@ class ConfigurationTest < ActiveSupport::TestCase
ENV["PASSWORD"] = nil ENV["PASSWORD"] = nil
end end
test "env args with only clear" do
config = Mrsk::Configuration.new(@deploy.tap { |c| c.merge!({
env: { "clear" => { "PORT" => "3000" } }
}) })
assert_equal [ "-e", "PORT=3000" ], config.env_args
end
test "env args with only secrets" do test "env args with only secrets" do
ENV["PASSWORD"] = "secret123" ENV["PASSWORD"] = "secret123"
config = Mrsk::Configuration.new(@deploy.tap { |c| c.merge!({ config = Mrsk::Configuration.new(@deploy.tap { |c| c.merge!({