Class: Shiplane::Deploy::NetworkConfiguration

Inherits:
Configuration show all
Defined in:
lib/shiplane/deploy/network_configuration.rb

Instance Attribute Summary

Attributes inherited from Configuration

#env, #name, #options

Instance Method Summary collapse

Methods inherited from Configuration

#docker_command, #initialize

Constructor Details

This class inherits a constructor from Shiplane::Deploy::Configuration

Instance Method Details

#connect_commands(role) ⇒ Object



10
11
12
13
14
15
16
17
18
19
20
21
# File 'lib/shiplane/deploy/network_configuration.rb', line 10

def connect_commands(role)
  @connect_commands ||=
  connections.map do |connection|
    [
      docker_command(role),
      "network connect",
      name,
      connection,
      "|| true",
    ].flatten.compact.join(" ")
  end
end

#connectionsObject



6
7
8
# File 'lib/shiplane/deploy/network_configuration.rb', line 6

def connections
  @connections ||= options.fetch(:connections, [])
end

#create_command(role) ⇒ Object



23
24
25
26
27
28
29
30
# File 'lib/shiplane/deploy/network_configuration.rb', line 23

def create_command(role)
  @create_command ||= [
    docker_command(role),
    "network create",
    name,
    "|| true",
  ].flatten.compact.join(" ")
end

#create_commands(role) ⇒ Object



32
33
34
35
36
37
# File 'lib/shiplane/deploy/network_configuration.rb', line 32

def create_commands(role)
  [
    create_command(role),
    connect_commands(role),
  ].flatten
end