|
6 | 6 | require "net/ssh/proxy/jump" |
7 | 7 |
|
8 | 8 | class Kamal::Configuration |
9 | | - delegate :service, :image, :labels, :hooks_path, to: :raw_config, allow_nil: true |
| 9 | + delegate :service, :labels, :hooks_path, to: :raw_config, allow_nil: true |
10 | 10 | delegate :argumentize, :optionize, to: Kamal::Utils |
11 | 11 |
|
12 | 12 | attr_reader :destination, :raw_config, :secrets |
@@ -149,6 +149,13 @@ def proxy_hosts |
149 | 149 | proxy_roles.flat_map(&:hosts).uniq |
150 | 150 | end |
151 | 151 |
|
| 152 | + def image |
| 153 | + name = raw_config&.image.presence |
| 154 | + name ||= raw_config&.service if registry.local? |
| 155 | + |
| 156 | + name |
| 157 | + end |
| 158 | + |
152 | 159 | def repository |
153 | 160 | [ registry.server, image ].compact.join("/") |
154 | 161 | end |
@@ -306,10 +313,12 @@ def ensure_destination_if_required |
306 | 313 | end |
307 | 314 |
|
308 | 315 | def ensure_required_keys_present |
309 | | - %i[ service image registry servers ].each do |key| |
| 316 | + %i[ service registry servers ].each do |key| |
310 | 317 | raise Kamal::ConfigurationError, "Missing required configuration for #{key}" unless raw_config[key].present? |
311 | 318 | end |
312 | 319 |
|
| 320 | + raise Kamal::ConfigurationError, "Missing required configuration for image" if image.blank? |
| 321 | + |
313 | 322 | unless role(primary_role_name).present? |
314 | 323 | raise Kamal::ConfigurationError, "The primary_role #{primary_role_name} isn't defined" |
315 | 324 | end |
|
0 commit comments