Class: Nvoi::Configuration::AppService
- Inherits:
-
Object
- Object
- Nvoi::Configuration::AppService
- 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
-
#command ⇒ Object
Returns the value of attribute command.
-
#domain ⇒ Object
Returns the value of attribute domain.
-
#env ⇒ Object
Returns the value of attribute env.
-
#healthcheck ⇒ Object
Returns the value of attribute healthcheck.
-
#mounts ⇒ Object
Returns the value of attribute mounts.
-
#port ⇒ Object
Returns the value of attribute port.
-
#pre_run_command ⇒ Object
Returns the value of attribute pre_run_command.
-
#servers ⇒ Object
Returns the value of attribute servers.
-
#subdomain ⇒ Object
Returns the value of attribute subdomain.
Instance Method Summary collapse
- #fqdn ⇒ Object
-
#initialize(data = nil) ⇒ AppService
constructor
A new instance of AppService.
- #web? ⇒ Boolean
- #worker? ⇒ Boolean
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
#command ⇒ Object
Returns the value of attribute command.
7 8 9 |
# File 'lib/nvoi/configuration/app_service.rb', line 7 def command @command end |
#domain ⇒ Object
Returns the value of attribute domain.
7 8 9 |
# File 'lib/nvoi/configuration/app_service.rb', line 7 def domain @domain end |
#env ⇒ Object
Returns the value of attribute env.
7 8 9 |
# File 'lib/nvoi/configuration/app_service.rb', line 7 def env @env end |
#healthcheck ⇒ Object
Returns the value of attribute healthcheck.
7 8 9 |
# File 'lib/nvoi/configuration/app_service.rb', line 7 def healthcheck @healthcheck end |
#mounts ⇒ Object
Returns the value of attribute mounts.
7 8 9 |
# File 'lib/nvoi/configuration/app_service.rb', line 7 def mounts @mounts end |
#port ⇒ Object
Returns the value of attribute port.
7 8 9 |
# File 'lib/nvoi/configuration/app_service.rb', line 7 def port @port end |
#pre_run_command ⇒ Object
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 |
#servers ⇒ Object
Returns the value of attribute servers.
7 8 9 |
# File 'lib/nvoi/configuration/app_service.rb', line 7 def servers @servers end |
#subdomain ⇒ Object
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
#fqdn ⇒ Object
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
23 24 25 |
# File 'lib/nvoi/configuration/app_service.rb', line 23 def web? @port && @port.positive? end |
#worker? ⇒ Boolean
27 28 29 |
# File 'lib/nvoi/configuration/app_service.rb', line 27 def worker? !web? end |