More natural api when you are just applying accessory to a single tag
This commit is contained in:
@@ -207,7 +207,9 @@ class Kamal::Configuration::Accessory
|
||||
end
|
||||
|
||||
def hosts_from_tags
|
||||
if accessory_config.key?("tags")
|
||||
if accessory_config.key?("tag")
|
||||
extract_hosts_from_config_with_tag(accessory_config["tag"])
|
||||
elsif accessory_config.key?("tags")
|
||||
accessory_config["tags"].flat_map { |tag| extract_hosts_from_config_with_tag(tag) }
|
||||
end
|
||||
end
|
||||
|
||||
@@ -53,8 +53,10 @@ accessories:
|
||||
- mysql-db2
|
||||
roles:
|
||||
- mysql
|
||||
tag: writer
|
||||
tags:
|
||||
- writer
|
||||
- reader
|
||||
|
||||
# Custom command
|
||||
#
|
||||
|
||||
@@ -2,8 +2,8 @@ class Kamal::Configuration::Validator::Accessory < Kamal::Configuration::Validat
|
||||
def validate!
|
||||
super
|
||||
|
||||
if (config.keys & [ "host", "hosts", "roles", "tags" ]).size != 1
|
||||
error "specify one of `host`, `hosts`, `roles` or `tags`"
|
||||
if (config.keys & [ "host", "hosts", "roles", "tag", "tags" ]).size != 1
|
||||
error "specify one of `host`, `hosts`, `roles`, `tag` or `tags`"
|
||||
end
|
||||
|
||||
validate_docker_options!(config["options"])
|
||||
|
||||
Reference in New Issue
Block a user