diff --git a/lib/kamal/configuration.rb b/lib/kamal/configuration.rb index 2848a365..1c87e051 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 814aa26e..96ceb36f 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__))