Class: Nvoi::Configuration::Root
- Inherits:
-
Object
- Object
- Nvoi::Configuration::Root
- Defined in:
- lib/nvoi/configuration/root.rb
Overview
Root holds the complete configuration including deployment config and runtime settings
Instance Attribute Summary collapse
-
#container_prefix ⇒ Object
Returns the value of attribute container_prefix.
-
#deploy ⇒ Object
Returns the value of attribute deploy.
-
#docker_network_name ⇒ Object
Returns the value of attribute docker_network_name.
-
#firewall_name ⇒ Object
Returns the value of attribute firewall_name.
-
#namer ⇒ Object
Returns the value of attribute namer.
-
#network_name ⇒ Object
Returns the value of attribute network_name.
-
#server_name ⇒ Object
Returns the value of attribute server_name.
-
#ssh_key_path ⇒ Object
Returns the value of attribute ssh_key_path.
-
#ssh_public_key ⇒ Object
Returns the value of attribute ssh_public_key.
Instance Method Summary collapse
- #architecture ⇒ Object
- #aws ⇒ Object
- #cloudflare ⇒ Object
- #docker_platform ⇒ Object
- #env_for_service(service_name) ⇒ Object
- #hetzner ⇒ Object
-
#initialize(deploy_config) ⇒ Root
constructor
A new instance of Root.
- #keep_count_value ⇒ Object
- #provider_name ⇒ Object
- #scaleway ⇒ Object
- #validate_config ⇒ Object
Constructor Details
#initialize(deploy_config) ⇒ Root
Returns a new instance of Root.
10 11 12 13 |
# File 'lib/nvoi/configuration/root.rb', line 10 def initialize(deploy_config) @deploy = deploy_config @namer = nil end |
Instance Attribute Details
#container_prefix ⇒ Object
Returns the value of attribute container_prefix.
7 8 9 |
# File 'lib/nvoi/configuration/root.rb', line 7 def container_prefix @container_prefix end |
#deploy ⇒ Object
Returns the value of attribute deploy.
7 8 9 |
# File 'lib/nvoi/configuration/root.rb', line 7 def deploy @deploy end |
#docker_network_name ⇒ Object
Returns the value of attribute docker_network_name.
7 8 9 |
# File 'lib/nvoi/configuration/root.rb', line 7 def docker_network_name @docker_network_name end |
#firewall_name ⇒ Object
Returns the value of attribute firewall_name.
7 8 9 |
# File 'lib/nvoi/configuration/root.rb', line 7 def firewall_name @firewall_name end |
#namer ⇒ Object
Returns the value of attribute namer.
7 8 9 |
# File 'lib/nvoi/configuration/root.rb', line 7 def namer @namer end |
#network_name ⇒ Object
Returns the value of attribute network_name.
7 8 9 |
# File 'lib/nvoi/configuration/root.rb', line 7 def network_name @network_name end |
#server_name ⇒ Object
Returns the value of attribute server_name.
7 8 9 |
# File 'lib/nvoi/configuration/root.rb', line 7 def server_name @server_name end |
#ssh_key_path ⇒ Object
Returns the value of attribute ssh_key_path.
7 8 9 |
# File 'lib/nvoi/configuration/root.rb', line 7 def ssh_key_path @ssh_key_path end |
#ssh_public_key ⇒ Object
Returns the value of attribute ssh_public_key.
7 8 9 |
# File 'lib/nvoi/configuration/root.rb', line 7 def ssh_public_key @ssh_public_key end |
Instance Method Details
#architecture ⇒ Object
56 57 58 59 60 61 62 |
# File 'lib/nvoi/configuration/root.rb', line 56 def architecture case provider_name when "hetzner" then hetzner&.architecture when "aws" then aws&.architecture when "scaleway" then scaleway&.architecture end end |
#aws ⇒ Object
44 45 46 |
# File 'lib/nvoi/configuration/root.rb', line 44 def aws @deploy.application.compute_provider.aws end |
#cloudflare ⇒ Object
52 53 54 |
# File 'lib/nvoi/configuration/root.rb', line 52 def cloudflare @deploy.application.domain_provider.cloudflare end |
#docker_platform ⇒ Object
64 65 66 67 68 69 |
# File 'lib/nvoi/configuration/root.rb', line 64 def docker_platform case architecture when "arm", "arm64" then "linux/arm64" else "linux/amd64" end end |
#env_for_service(service_name) ⇒ Object
19 20 21 |
# File 'lib/nvoi/configuration/root.rb', line 19 def env_for_service(service_name) Utils::EnvResolver.new(self).env_for_service(service_name) end |
#hetzner ⇒ Object
40 41 42 |
# File 'lib/nvoi/configuration/root.rb', line 40 def hetzner @deploy.application.compute_provider.hetzner end |
#keep_count_value ⇒ Object
71 72 73 74 |
# File 'lib/nvoi/configuration/root.rb', line 71 def keep_count_value count = @deploy.application.keep_count count && count.positive? ? count : 2 end |
#provider_name ⇒ Object
32 33 34 35 36 37 38 |
# File 'lib/nvoi/configuration/root.rb', line 32 def provider_name return "hetzner" if @deploy.application.compute_provider.hetzner return "aws" if @deploy.application.compute_provider.aws return "scaleway" if @deploy.application.compute_provider.scaleway "" end |
#scaleway ⇒ Object
48 49 50 |
# File 'lib/nvoi/configuration/root.rb', line 48 def scaleway @deploy.application.compute_provider.scaleway end |
#validate_config ⇒ Object
23 24 25 26 27 28 29 30 |
# File 'lib/nvoi/configuration/root.rb', line 23 def validate_config app = @deploy.application validate_providers_config validate_database_secrets(app.database) if app.database inject_database_env_vars validate_service_server_bindings validate_domain_uniqueness end |