From afefd32379b39eaaa40cd2537a16449e963f712d Mon Sep 17 00:00:00 2001 From: Adam Miribyan <321133+adammiribyan@users.noreply.github.com> Date: Sat, 28 Jan 2023 17:19:07 +0100 Subject: [PATCH] Allow "clear" only env configuration --- lib/mrsk/utils.rb | 2 +- test/configuration_test.rb | 8 ++++++++ 2 files changed, 9 insertions(+), 1 deletion(-) diff --git a/lib/mrsk/utils.rb b/lib/mrsk/utils.rb index 0d17185f..0484f258 100644 --- a/lib/mrsk/utils.rb +++ b/lib/mrsk/utils.rb @@ -18,7 +18,7 @@ module Mrsk::Utils if (secrets = env["secret"]).present? argumentize("-e", secrets.to_h { |key| [ key, ENV.fetch(key) ] }, redacted: true) + argumentize("-e", env["clear"]) else - argumentize "-e", env + argumentize "-e", env.fetch("clear", env) end end diff --git a/test/configuration_test.rb b/test/configuration_test.rb index 21f9c92e..1a275c35 100644 --- a/test/configuration_test.rb +++ b/test/configuration_test.rb @@ -105,6 +105,14 @@ class ConfigurationTest < ActiveSupport::TestCase ENV["PASSWORD"] = nil 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 ENV["PASSWORD"] = "secret123" config = Mrsk::Configuration.new(@deploy.tap { |c| c.merge!({