Class: Nvoi::Configuration::Override
- Inherits:
-
Object
- Object
- Nvoi::Configuration::Override
- Defined in:
- lib/nvoi/configuration/override.rb
Overview
Override allows CLI to override app name and subdomain for branch deployments
Constant Summary collapse
- BRANCH_PATTERN =
/\A[a-z0-9-]+\z/
Instance Attribute Summary collapse
-
#branch ⇒ Object
readonly
Returns the value of attribute branch.
Instance Method Summary collapse
-
#apply(config) ⇒ Object
Apply overrides to config.
-
#initialize(branch:) ⇒ Override
constructor
A new instance of Override.
Constructor Details
#initialize(branch:) ⇒ Override
Returns a new instance of Override.
11 12 13 14 |
# File 'lib/nvoi/configuration/override.rb', line 11 def initialize(branch:) validate!(branch) @branch = branch end |
Instance Attribute Details
#branch ⇒ Object (readonly)
Returns the value of attribute branch.
9 10 11 |
# File 'lib/nvoi/configuration/override.rb', line 9 def branch @branch end |
Instance Method Details
#apply(config) ⇒ Object
Apply overrides to config
17 18 19 20 21 22 23 24 25 26 27 28 29 30 |
# File 'lib/nvoi/configuration/override.rb', line 17 def apply(config) # Prefix branch to application name config.deploy.application.name = "#{config.deploy.application.name}-#{@branch}" # Prefix branch to all service subdomains config.deploy.application.app.each_value do |svc| svc.subdomain = "#{@branch}-#{svc.subdomain}" end # Regenerate resource names with new app name regenerate_resource_names(config) config end |