Skip to content
Open
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
4 changes: 2 additions & 2 deletions lib/kamal/configuration.rb
Original file line number Diff line number Diff line change
Expand Up @@ -18,14 +18,14 @@ class Kamal::Configuration

class << self
def create_from(config_file:, destination: nil, version: nil)
ENV["KAMAL_DESTINATION"] = destination

raw_config = load_raw_config(config_file: config_file, destination: destination)

new raw_config, destination: destination, version: version
end

def load_raw_config(config_file:, destination: nil)
ENV["KAMAL_DESTINATION"] = destination

load_config_files(config_file, *destination_config_file(config_file, destination))
end

Expand Down
8 changes: 8 additions & 0 deletions test/cli/main_test.rb
Original file line number Diff line number Diff line change
Expand Up @@ -808,6 +808,14 @@ class CliMainTest < CliTestCase
end
end

test "render an alias with the destination" do
ENV.delete("KAMAL_DESTINATION")

run_command("console", "-d", "world", config_file: "deploy_with_destination_aliases").tap do |output|
assert_match "bin/console world", output
end
end

test "upgrade" do
invoke_options = base_invoke_options(config_file: "deploy_with_accessories.yml", version: nil, confirmed: true, rolling: false)
Kamal::Cli::Main.any_instance.expects(:invoke).with("kamal:cli:proxy:upgrade", [], invoke_options)
Expand Down
2 changes: 2 additions & 0 deletions test/fixtures/deploy_with_destination_aliases.world.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
servers:
- 1.1.1.1
9 changes: 9 additions & 0 deletions test/fixtures/deploy_with_destination_aliases.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
service: app
image: dhh/app
registry:
username: user
password: pw
builder:
arch: amd64
aliases:
console: app exec --reuse "bin/console <%= ENV["KAMAL_DESTINATION"] %>"