Skip to content

Commit 75de40c

Browse files
authored
Merge pull request #1714 from nbgoodall/main
Make environment variables optional for tagged hosts
2 parents 6394511 + d7fe948 commit 75de40c

File tree

2 files changed

+8
-1
lines changed

2 files changed

+8
-1
lines changed

lib/kamal/configuration/role.rb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,7 @@ def hosts
3636
end
3737

3838
def env_tags(host)
39-
tagged_hosts.fetch(host).collect { |tag| config.env_tag(tag) }
39+
tagged_hosts.fetch(host).collect { |tag| config.env_tag(tag) }.compact
4040
end
4141

4242
def cmd

test/configuration/role_test.rb

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -29,6 +29,13 @@ class ConfigurationRoleTest < ActiveSupport::TestCase
2929
assert_equal [ "1.1.1.3", "1.1.1.4" ], config_with_roles.role(:workers).hosts
3030
end
3131

32+
test "missing env tag is ignored" do
33+
@deploy_with_roles[:servers]["workers"]["hosts"] = [ { "1.1.1.3" => [ "job" ] } ]
34+
35+
role = Kamal::Configuration.new(@deploy_with_roles).role(:workers)
36+
assert_equal "redis://a/b", role.env("1.1.1.3").clear["REDIS_URL"]
37+
end
38+
3239
test "cmd" do
3340
assert_nil config.role(:web).cmd
3441
assert_equal "bin/jobs", config_with_roles.role(:workers).cmd

0 commit comments

Comments
 (0)