Class: Nvoi::Configuration::AppService

Inherits:
Object
  • Object
show all
Defined in:
lib/nvoi/configuration/app_service.rb

Overview

AppService defines a service in the app section

Defined Under Namespace

Classes: HealthCheck

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(data = nil) ⇒ AppService

Returns a new instance of AppService.



10
11
12
13
14
15
16
17
18
19
20
21
# File 'lib/nvoi/configuration/app_service.rb', line 10

def initialize(data = nil)
  data ||= {}
  @servers = data["servers"] || []
  @domain = data["domain"]
  @subdomain = data["subdomain"]
  @port = data["port"]&.to_i
  @healthcheck = data["healthcheck"] ? HealthCheck.new(data["healthcheck"]) : nil
  @command = data["command"]
  @pre_run_command = data["pre_run_command"]
  @env = data["env"] || {}
  @mounts = data["mounts"] || {}
end

Instance Attribute Details

#commandObject

Returns the value of attribute command.



7
8
9
# File 'lib/nvoi/configuration/app_service.rb', line 7

def command
  @command
end

#domainObject

Returns the value of attribute domain.



7
8
9
# File 'lib/nvoi/configuration/app_service.rb', line 7

def domain
  @domain
end

#envObject

Returns the value of attribute env.



7
8
9
# File 'lib/nvoi/configuration/app_service.rb', line 7

def env
  @env
end

#healthcheckObject

Returns the value of attribute healthcheck.



7
8
9
# File 'lib/nvoi/configuration/app_service.rb', line 7

def healthcheck
  @healthcheck
end

#mountsObject

Returns the value of attribute mounts.



7
8
9
# File 'lib/nvoi/configuration/app_service.rb', line 7

def mounts
  @mounts
end

#portObject

Returns the value of attribute port.



7
8
9
# File 'lib/nvoi/configuration/app_service.rb', line 7

def port
  @port
end

#pre_run_commandObject

Returns the value of attribute pre_run_command.



7
8
9
# File 'lib/nvoi/configuration/app_service.rb', line 7

def pre_run_command
  @pre_run_command
end

#serversObject

Returns the value of attribute servers.



7
8
9
# File 'lib/nvoi/configuration/app_service.rb', line 7

def servers
  @servers
end

#subdomainObject

Returns the value of attribute subdomain.



7
8
9
# File 'lib/nvoi/configuration/app_service.rb', line 7

def subdomain
  @subdomain
end

Instance Method Details

#fqdnObject



31
32
33
34
35
# File 'lib/nvoi/configuration/app_service.rb', line 31

def fqdn
  return nil if @domain.blank?

  @subdomain.blank? ? @domain : "#{@subdomain}.#{@domain}"
end

#web?Boolean

Returns:

  • (Boolean)


23
24
25
# File 'lib/nvoi/configuration/app_service.rb', line 23

def web?
  @port && @port.positive?
end

#worker?Boolean

Returns:

  • (Boolean)


27
28
29
# File 'lib/nvoi/configuration/app_service.rb', line 27

def worker?
  !web?
end