Skip to content

Commit

Permalink
Merge pull request #1019 from nickhammond/ENV/destination
Browse files Browse the repository at this point in the history
Set KAMAL_DESTINATION when loading config
  • Loading branch information
djmb authored Oct 2, 2024
2 parents c10b3fb + 1d8c40f commit 276b469
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 0 deletions.
2 changes: 2 additions & 0 deletions lib/kamal/configuration.rb
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
7 changes: 7 additions & 0 deletions test/configuration_test.rb
Original file line number Diff line number Diff line change
Expand Up @@ -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__))

Expand Down

0 comments on commit 276b469

Please sign in to comment.