Class: Kamal::Configuration::Boot

Inherits:
Object
  • Object
show all
Includes:
Validation
Defined in:
lib/kamal/configuration/boot.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Methods included from Validation

#validate!, #validation_yml

Constructor Details

#initialize(config:) ⇒ Boot

Returns a new instance of Boot.



6
7
8
9
10
# File 'lib/kamal/configuration/boot.rb', line 6

def initialize(config:)
  @boot_config = config.raw_config.boot || {}
  @host_count = config.all_hosts.count
  validate! boot_config
end

Instance Attribute Details

#boot_configObject (readonly)

Returns the value of attribute boot_config.



4
5
6
# File 'lib/kamal/configuration/boot.rb', line 4

def boot_config
  @boot_config
end

#host_countObject (readonly)

Returns the value of attribute host_count.



4
5
6
# File 'lib/kamal/configuration/boot.rb', line 4

def host_count
  @host_count
end

Instance Method Details

#limitObject



12
13
14
15
16
17
18
19
20
# File 'lib/kamal/configuration/boot.rb', line 12

def limit
  limit = boot_config["limit"]

  if limit.to_s.end_with?("%")
    [ host_count * limit.to_i / 100, 1 ].max
  else
    limit
  end
end

#waitObject



22
23
24
# File 'lib/kamal/configuration/boot.rb', line 22

def wait
  boot_config["wait"]
end