Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Set KAMAL_DESTINATION when loading config #1019

Merged
merged 2 commits into from
Oct 2, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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
nickhammond marked this conversation as resolved.
Show resolved Hide resolved

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