Class: Nvoi::Configuration::Application
- Inherits:
-
Object
- Object
- Nvoi::Configuration::Application
- Defined in:
- lib/nvoi/configuration/application.rb
Overview
Application contains application-level configuration
Instance Attribute Summary collapse
-
#app ⇒ Object
Returns the value of attribute app.
-
#compute_provider ⇒ Object
Returns the value of attribute compute_provider.
-
#database ⇒ Object
Returns the value of attribute database.
-
#domain_provider ⇒ Object
Returns the value of attribute domain_provider.
-
#env ⇒ Object
Returns the value of attribute env.
-
#environment ⇒ Object
Returns the value of attribute environment.
-
#keep_count ⇒ Object
Returns the value of attribute keep_count.
-
#name ⇒ Object
Returns the value of attribute name.
-
#secrets ⇒ Object
Returns the value of attribute secrets.
-
#servers ⇒ Object
Returns the value of attribute servers.
-
#services ⇒ Object
Returns the value of attribute services.
-
#ssh_keys ⇒ Object
Returns the value of attribute ssh_keys.
Instance Method Summary collapse
- #app_by_name(name) ⇒ Object
-
#initialize(data = nil) ⇒ Application
constructor
A new instance of Application.
- #server_by_name(name) ⇒ Object
- #web_apps ⇒ Object
- #workers ⇒ Object
Constructor Details
#initialize(data = nil) ⇒ Application
Returns a new instance of Application.
11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 |
# File 'lib/nvoi/configuration/application.rb', line 11 def initialize(data = nil) data ||= {} @name = data["name"] @environment = data["environment"] || "production" @domain_provider = Providers::DomainProvider.new(data["domain_provider"]) @compute_provider = Providers::ComputeProvider.new(data["compute_provider"]) @keep_count = data["keep_count"]&.to_i @servers = (data["servers"] || {}).transform_values { |v| Server.new(v) } @app = (data["app"] || {}).transform_values { |v| AppService.new(v) } @database = data["database"] ? Database.new(data["database"]) : nil @services = (data["services"] || {}).transform_values { |v| Service.new(v) } @env = data["env"] || {} @secrets = data["secrets"] || {} @ssh_keys = data["ssh_keys"] ? SshKey.new(data["ssh_keys"]) : nil end |
Instance Attribute Details
#app ⇒ Object
Returns the value of attribute app.
7 8 9 |
# File 'lib/nvoi/configuration/application.rb', line 7 def app @app end |
#compute_provider ⇒ Object
Returns the value of attribute compute_provider.
7 8 9 |
# File 'lib/nvoi/configuration/application.rb', line 7 def compute_provider @compute_provider end |
#database ⇒ Object
Returns the value of attribute database.
7 8 9 |
# File 'lib/nvoi/configuration/application.rb', line 7 def database @database end |
#domain_provider ⇒ Object
Returns the value of attribute domain_provider.
7 8 9 |
# File 'lib/nvoi/configuration/application.rb', line 7 def domain_provider @domain_provider end |
#env ⇒ Object
Returns the value of attribute env.
7 8 9 |
# File 'lib/nvoi/configuration/application.rb', line 7 def env @env end |
#environment ⇒ Object
Returns the value of attribute environment.
7 8 9 |
# File 'lib/nvoi/configuration/application.rb', line 7 def environment @environment end |
#keep_count ⇒ Object
Returns the value of attribute keep_count.
7 8 9 |
# File 'lib/nvoi/configuration/application.rb', line 7 def keep_count @keep_count end |
#name ⇒ Object
Returns the value of attribute name.
7 8 9 |
# File 'lib/nvoi/configuration/application.rb', line 7 def name @name end |
#secrets ⇒ Object
Returns the value of attribute secrets.
7 8 9 |
# File 'lib/nvoi/configuration/application.rb', line 7 def secrets @secrets end |
#servers ⇒ Object
Returns the value of attribute servers.
7 8 9 |
# File 'lib/nvoi/configuration/application.rb', line 7 def servers @servers end |
#services ⇒ Object
Returns the value of attribute services.
7 8 9 |
# File 'lib/nvoi/configuration/application.rb', line 7 def services @services end |
#ssh_keys ⇒ Object
Returns the value of attribute ssh_keys.
7 8 9 |
# File 'lib/nvoi/configuration/application.rb', line 7 def ssh_keys @ssh_keys end |
Instance Method Details
#app_by_name(name) ⇒ Object
27 28 29 |
# File 'lib/nvoi/configuration/application.rb', line 27 def app_by_name(name) @app[name.to_s] end |
#server_by_name(name) ⇒ Object
31 32 33 |
# File 'lib/nvoi/configuration/application.rb', line 31 def server_by_name(name) @servers[name.to_s] end |
#web_apps ⇒ Object
35 36 37 |
# File 'lib/nvoi/configuration/application.rb', line 35 def web_apps @app.select { |_, cfg| cfg.web? } end |
#workers ⇒ Object
39 40 41 |
# File 'lib/nvoi/configuration/application.rb', line 39 def workers @app.reject { |_, cfg| cfg.web? } end |