From 73c78079bc1bf385e3f5cbe42b56d4b037acdd0a Mon Sep 17 00:00:00 2001 From: Nick Hammond Date: Tue, 1 Oct 2024 08:16:52 -0700 Subject: [PATCH 1/2] Set KAMAL_DESTINATION when loading config --- lib/kamal/configuration.rb | 2 ++ test/configuration_test.rb | 7 +++++++ 2 files changed, 9 insertions(+) diff --git a/lib/kamal/configuration.rb b/lib/kamal/configuration.rb index 2848a3650..1c87e051a 100644 --- a/lib/kamal/configuration.rb +++ b/lib/kamal/configuration.rb @@ -20,6 +20,8 @@ class Kamal::Configuration class << self def create_from(config_file:, destination: nil, version: nil) + ENV['KAMAL_DESTINATION'] = destination + raw_config = load_config_files(config_file, *destination_config_file(config_file, destination)) new raw_config, destination: destination, version: version diff --git a/test/configuration_test.rb b/test/configuration_test.rb index 814aa26e1..96ceb36fb 100644 --- a/test/configuration_test.rb +++ b/test/configuration_test.rb @@ -222,6 +222,13 @@ class ConfigurationTest < ActiveSupport::TestCase assert_equal "my-user", config.registry.username end + test "destination is loaded into env" do + dest_config_file = Pathname.new(File.expand_path("fixtures/deploy_for_dest.yml", __dir__)) + + config = Kamal::Configuration.create_from config_file: dest_config_file, destination: "world" + assert_equal ENV['KAMAL_DESTINATION'], "world" + end + test "destination yml config merge" do dest_config_file = Pathname.new(File.expand_path("fixtures/deploy_for_dest.yml", __dir__)) From 1d8c40f5d2048ac8d24533ee0151732bf4f9817e Mon Sep 17 00:00:00 2001 From: Nick Hammond Date: Tue, 1 Oct 2024 08:20:21 -0700 Subject: [PATCH 2/2] Run RC --- lib/kamal/configuration.rb | 2 +- test/configuration_test.rb | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/lib/kamal/configuration.rb b/lib/kamal/configuration.rb index 1c87e051a..59563de9e 100644 --- a/lib/kamal/configuration.rb +++ b/lib/kamal/configuration.rb @@ -20,7 +20,7 @@ class Kamal::Configuration class << self def create_from(config_file:, destination: nil, version: nil) - ENV['KAMAL_DESTINATION'] = destination + ENV["KAMAL_DESTINATION"] = destination raw_config = load_config_files(config_file, *destination_config_file(config_file, destination)) diff --git a/test/configuration_test.rb b/test/configuration_test.rb index 96ceb36fb..eaeffa22d 100644 --- a/test/configuration_test.rb +++ b/test/configuration_test.rb @@ -226,7 +226,7 @@ class ConfigurationTest < ActiveSupport::TestCase dest_config_file = Pathname.new(File.expand_path("fixtures/deploy_for_dest.yml", __dir__)) config = Kamal::Configuration.create_from config_file: dest_config_file, destination: "world" - assert_equal ENV['KAMAL_DESTINATION'], "world" + assert_equal ENV["KAMAL_DESTINATION"], "world" end test "destination yml config merge" do